Objective-C
Generate JWTs
You need to generate a JWT for each user. The JWT is used to authenticate the user.
In the following code remember to replace the APPLICATION_ID variable with id of your application:
vonage jwt --key_file=./private.key --acl='{"paths":{"/*/users/**":{},"/*/conversations/**":{},"/*/sessions/**":{},"/*/devices/**":{},"/*/image/**":{},"/*/media/**":{},"/*/push/**":{},"/*/knocking/**":{},"/*/legs/**":{}}}' --subject=Alice --app_id=APP_ID vonage jwt --key_file=./private.key --acl='{"paths":{"/*/users/**":{},"/*/conversations/**":{},"/*/sessions/**":{},"/*/devices/**":{},"/*/image/**":{},"/*/media/**":{},"/*/push/**":{},"/*/knocking/**":{},"/*/legs/**":{}}}' --subject=Bob --app_id=APP_ID application_id=APPLICATION_ID
The above commands set the expiry of the JWT to one day from now, which is the maximum.
Make a note of the JWT you generated for each user.
NOTE: In a production environment, your application should expose an endpoint that generates a JWT for each client request.
Further information
Creating an iOS chat app
Create a iOS application that enables users to message each other
手順
1
Introduction to this task2
Prerequisites3
Create a Vonage Application4
Create a conversation5
Create the users6
Add users to the conversation7
Generate JWTs8
Xcode project and workspace9
Building the log in interface10
Building the user model11
NXMClient12
Building the chat interface13
Chat events14
Sending a message15
What's next?