Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is Twilio API_KEY_SECRET is same as the Twilio Auth Token in console?

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);
like image 614
SpaceX Avatar asked Jan 20 '17 00:01

SpaceX


1 Answers

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.

like image 143
Srikanth A Avatar answered Jan 02 '23 18:01

Srikanth A