How to use the twilio.AccessToken.VideoGrant function in twilio

To help you get started, we’ve selected a few twilio examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github twilio / twilio-video.js / test / lib / token.js View on Github external
apiKeySid,
    apiKeySecret,
    { ttl });

  accessToken.identity = identity;

  let grant = options.grant;
  switch (grant) {
    case 'conversations':
      grant = new AccessToken.ConversationsGrant({
        identity,
        configurationProfileSid
      });
      break;
    case 'video':
      grant = new AccessToken.VideoGrant({
        identity
      });
      break;
    default:
      // Do nothing.
  }

  if (grant) {
    accessToken.addGrant(grant);
  }

  return accessToken.toJwt('HS256');
}
github twilio / twilio-video.js-recording-bot / index.js View on Github external
function createToken(identity) {
  const token = new AccessToken(
    process.env.ACCOUNT_SID,
    process.env.API_KEY_SID,
    process.env.API_KEY_SECRET);
  token.identity = identity;
  token.addGrant(new AccessToken.VideoGrant());
  return token.toJwt();
}
github twilio / draw-with-twilio / lib / token.js View on Github external
function createAccessToken(identity, options) {
  options = options || {};
  const accessTokenGenerator = new AccessToken(
    process.env.ACCOUNT_SID,
    process.env.API_KEY_SID,
    process.env.API_KEY_SECRET,
    options);
  accessTokenGenerator.identity = identity;
  accessTokenGenerator.addGrant(new AccessToken.VideoGrant());
  return accessTokenGenerator.toJwt();
}