提问者:小点点

Twilio错误20154无效的令牌声明


这是关于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:无效的令牌声明集(http://prntscr.com/j1m1uk)。任何帮助都将不胜感激。


共1个答案

匿名用户

就我而言,原因是客户的身份是用Unicode编写的。尝试使用ASCII身份来解决问题。

相关问题