【发布时间】:2018-07-12 12:35:32
【问题描述】:
这是关于 Twilio 可编程视频的。我在服务器端成功创建了一个新房间,然后生成令牌并添加视频授权以通过 PHP 生成 JWT。
$token = new AccessToken(
$this->TWILIO_ACCOUNT_SID,
$this->TWILIO_API_KEY,
$this->TWILIO_API_SECRET, 3600,
$user_id //<--- Identitiy
);
// Create Video grant
$videoGrant = new VideoGrant();
$videoGrant->setRoom($slot_id);
// Add grant to token
$token->addGrant($videoGrant);
// render token to string
$jwttoken = $token->toJWT();
这通过 API 调用传递给我的 ReactApp。此 JWT 在 jwt.io (http://prntscr.com/j1m161) 上显示正确的 RoomName,但是当尝试在前端使用时,我收到此错误:TwilioError: Invalid Token claim set (http://prntscr.com/j1m1uk)。任何帮助将不胜感激。
【问题讨论】:
-
我正在使用可编程聊天并使用 PHP 代码生成令牌。我也面临类似的令牌授权问题。看起来 PHP SDK 有问题。在过去的两天里,我一直在努力解决令牌问题。您使用的是最新的 PHP SDK 吗?
标签: twilio twilio-api