How to create your own JWT token?

How to create your own JWT token?

JSON Web Token (JWT) is an open standard (RFC 7519) that specifies a compact and self-contained method which can be used for securely sharing information between two parties by authenticating user access.

Once a user is logged in, each future request will contain the JWT, allowing the user to access services and resources that are accessible with that token.

JWT based authentication with Jitsi Meet requires your business application to generate a JSON Web Token when you schedule a meeting that can be sent (attached with the meeting URL and generated token) to the user in order to have a secure audio and video conferencing. Users can join the meeting by simply clicking on the link and join the meeting without waiting at the meeting lobby to be authorized by the Moderator without manually providing any other username or password. This way no zoom bombing sort of users can also join even though they would know the meeting URL as there is a username and password individually protecting your meetings.

Below are the steps to create your own JWT token for the conference.

Step 1

First, to create the JWT token, you should log in to the servers and get the APP ID and App Secret from there.

Path to get the mentioned APP ID and App Secret -

/etc/prosody/conf.avail/YOUR_DOMAIN.cfg.lua

Look for  VirtualHost "YOUR_DOMAIN"



Step 2 - Generate a JSON Web Token

For testing your Jitsi with JWT installation you will need a token

Generate your JWT with your domain name, app id and app secret by login https://jwt.io/

  • HEADER: ALGORITHM & TOKEN TYPE are included
    Leave it as it is
  • PAYLOAD: DATA is included. Most of the information consists of the payload section. Token data such as user name, date of token generation or expiry date, user's rights on the application pass through payload
    To generate the payload section following parameters should be replaced with your client and application data.
Client data:
- avatar - add the URL of your client avatar
- name - name of your client
- email - email of your client


Application data:
- iss - Your app_id (can be copied from prosody configuration file)
- sub - your xmpp domain  (can be copied from prosody configuration file)
- exp - your token expiration date in unix timestamp standard

A sample of Payload is given below,

{
  "context": {
    "user": {
      "avatar": "your_client_avatar_url",
      "name": "your_client_name",
      "email": "your_client_email"
    }
  },
  "moderator": true,
  "aud": "jitsi",
  "iss": "your_app_id",
  "sub": "jitsimeet.your_domain.com",
  "room": "*",
  "exp": 1753498815
}

A screenshot of token data from the jwt.io website is given below,


VERIFY SIGNATURE

Replace the placeholder your-256-bit-secret with your app secret. The below screenshot shows how the app secret is replaced by the "asdfasdf".


Step 3 - Check your access with JWT

  1. Copy the token that has been generated under the Encoded section.
  2. Now initiate a meeting on Jitsi Meet by sending the generated token with the meeting URL:
https://YOUR_DOMAIN/jwt_test_room?jwt=YOUR_TOKEN

You should replace YOUR_TOKEN with the copied code that you get from the Encoded section.

Have trouble setting up JWT tokens for your setup? please contact us via hello@meetrix.io or the contact us


Discover Seamless Meetings with >>>
Meetrix