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
NodeJS
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_KEYandSECRET, which you can get them from here. -
In payload, you will add your
apikeyandpermissions.apikey: You can get it from here.permissions: List of permissions that you want to allow.allow_joinallow_modask_join
-
Then, you will sign this payload with your
SECRETand jwt options. -
You can learn more, here
Got a Question? Ask us on discord