JavaScript
Generate JWTs
You need to generate a JWT for each user. The JWT is used to authenticate the user. Run the following commands, remember to replace the APPLICATION_ID variable with id of your application and PRIVATE_KEY with the name of your private key file.
NOTE: To quickly get your application id you can run the Vonage CLI command, vonage apps, to view a list of your applications.
For Alice:
vonage jwt --app_id=APPLICATION_ID --subject=Alice --key_file=./PRIVATE_KEY --acl='{"paths":{"/*/users/**":{},"/*/conversations/**":{},"/*/sessions/**":{},"/*/devices/**":{},"/*/image/**":{},"/*/media/**":{},"/*/push/**":{},"/*/knocking/**":{},"/*/legs/**":{}}}'
And for Bob:
vonage jwt --app_id=APPLICATION_ID --subject=Bob --key_file=./PRIVATE_KEY --acl='{"paths":{"/*/users/**":{},"/*/conversations/**":{},"/*/sessions/**":{},"/*/devices/**":{},"/*/image/**":{},"/*/media/**":{},"/*/push/**":{},"/*/knocking/**":{},"/*/legs/**":{}}}'
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 a web-based chat app
Create a web 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
Create the UI9
Authenticate your Users10
Fetch the conversation11
Show the message history12
Send a message13
Add typing indicators14
Run your application15
What's next?