Closed alexis1111 closed 1 year ago
This is just a general wrapper around the Twilio SDK, I'm willing to try and help you with the issue, but I'll need more context.
This is just a general wrapper around the Twilio SDK, I'm willing to try and help you with the issue, but I'll need more context.
Sure! i need to generate a token to grant access to the video feature on the client app, im using the following code
async generateToken(user: string): Promise<any> {
const AccessToken = twilio.jwt.AccessToken;
const VideoGrant = AccessToken.VideoGrant;
const grant = new VideoGrant({
room: 'test-room',
});
const token = new AccessToken(
process.env.TWILIO_ACCOUNT_SID,
process.env.TWILIO_API_KEY,
process.env.TWILIO_API_SECRET,
{ identity: user },
);
token.addGrant(grant);
return { 'twilio-token': token.toJwt() };
}
im using twilio directly like this import * as twilio from 'twilio';
, but it would be nice to just use this.twilioService.jwt.AccessToken
thank you so much for replying!
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
i can't find a way to generate a token like this
const AccessToken = require('twilio').jwt.AccessToken;
, this appears on the twilio api docs but not here :/