I am trying to use Twilio Video for which I need to obtain access tokens(jwt) from my app server.
Below is the NodeJS app server code that generates an Access token. In the below credentials, API_KEY_SECRET is required, I thought this is same as Twilio Auth token that can be found in the Twilio console.
Is my understanding correct ? if not, where can I find the API_KEY_SECRET ?
var AccessToken = require('twilio').AccessToken;
// Substitute your Twilio AccountSid and ApiKey details
var ACCOUNT_SID = 'accountSid';
var API_KEY_SID = 'apiKeySid';
var API_KEY_SECRET = 'apiKeySecret';
// Create an Access Token
var accessToken = new AccessToken(
ACCOUNT_SID,
API_KEY_SID,
API_KEY_SECRET
);
// Set the Identity of this token
accessToken.identity = 'example-user';
// Grant access to Conversations
var grant = new AccessToken.ConversationsGrant();
grant.configurationProfileSid = 'configurationProfileSid';
accessToken.addGrant(grant);
// Serialize the token as a JWT
var jwt = accessToken.toJwt();
console.log(jwt);
When you create API Key(API_KEY_SID) - you'll be shown the Key's secret(API_KEY_SECRET),
You'll use the the secret(API_KEY_SECRET) of the API Key(API_KEY_SID) you created in step 1 to generate an access-token(ACCESS_TOKEN) using the Twilio Helper Library
Detailed Explanation here - Twilio Authorization - Refer the step 1,2,3, Its explained with example in different languages, including Nodejs.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With