Skip to main content
Version: /v2

Authentication

  • The VideoSDK API uses authentication token to authenticate api requests.

  • In REST APIs, token will be passed in header field called "Authorization".

  • For Example:

TOKEN GENERATION
const jwt = require('jsonwebtoken');

const API_KEY = <YOUR API KEY>;
const SECRET = <YOUR SECRET>;

const options = {
expiresIn: '120m',
algorithm: 'HS256'
};
const payload = {
apikey: API_KEY,
permissions: [`allow_join`], // `ask_join` || `allow_mod`
version: 2, //OPTIONAL
roomId: `2kyv-gzay-64pg`, //OPTIONAL
participantId: `lxvdplwt`, //OPTIONAL
roles: ['crawler', 'rtc'], //OPTIONAL
};

const token = jwt.sign(payload, SECRET, options);
console.log(token);

How to generate authentication token ?

  • In order to generate authentication token, you will need API_KEY and SECRET, which you can get them from here.

  • In payload, you will add your apikey and permissions.

    • apikey: You can get it from here.
    • permissions: List of permissions that you want to allow.
      • allow_join
      • allow_mod
      • ask_join
  • Then, you will sign this payload with your SECRET and jwt options.

  • You can learn more, here

Got a Question? Ask us on discord