Twilio 配置文件 SID
Twilio configuration Profile SID
我正在使用 Twilio 视频 API。在我的 node.js 中,我使用了这段代码,
var grant = new VideoGrant();
它需要 configurationProfileSid
但我找不到有关如何获取它的文档?
我认为这是一个能力令牌。
但是如何使用 twilio node js 获取它呢?
或者有什么其他方法可以得到吗?
此处为 Twilio 开发人员布道师。
配置文件过去是必需的,但已被弃用。所以你不再需要 configurationProfileSid
。不过,您可以授予访问特定房间的权限。
这是一个 example Node.js application that generates access tokens for a Video application。重要的部分是生成令牌的路由:
app.get('/', function(request, response) {
// Create an access token which we will sign and return to the client,
// containing the grant we just created
var token = new AccessToken(
process.env.TWILIO_ACCOUNT_SID,
process.env.TWILIO_API_KEY,
process.env.TWILIO_API_SECRET
);
// Assign identity to the token
token.identity = request.query.identity || 'identity';
// Grant the access token Twilio Video capabilities
var grant = new VideoGrant();
grant.room = request.query.room;
token.addGrant(grant);
// Serialize the token to a JWT string
response.send(token.toJwt());
});
这个 documentation on access tokens 应该也有帮助。
我正在使用 Twilio 视频 API。在我的 node.js 中,我使用了这段代码,
var grant = new VideoGrant();
它需要 configurationProfileSid
但我找不到有关如何获取它的文档?
我认为这是一个能力令牌。
但是如何使用 twilio node js 获取它呢?
或者有什么其他方法可以得到吗?
此处为 Twilio 开发人员布道师。
配置文件过去是必需的,但已被弃用。所以你不再需要 configurationProfileSid
。不过,您可以授予访问特定房间的权限。
这是一个 example Node.js application that generates access tokens for a Video application。重要的部分是生成令牌的路由:
app.get('/', function(request, response) {
// Create an access token which we will sign and return to the client,
// containing the grant we just created
var token = new AccessToken(
process.env.TWILIO_ACCOUNT_SID,
process.env.TWILIO_API_KEY,
process.env.TWILIO_API_SECRET
);
// Assign identity to the token
token.identity = request.query.identity || 'identity';
// Grant the access token Twilio Video capabilities
var grant = new VideoGrant();
grant.room = request.query.room;
token.addGrant(grant);
// Serialize the token to a JWT string
response.send(token.toJwt());
});
这个 documentation on access tokens 应该也有帮助。