【问题标题】:Twilio Error 20154 Invalid token claimsTwilio 错误 20154 无效的令牌声明
【发布时间】: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


【解决方案1】:

在我的例子中,原因是客户的身份是用 Unicode 编写的。尝试使用ASCII标识来解决问题。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2023-03-09
    • 1970-01-01
    • 2020-01-26
    • 1970-01-01
    • 2016-12-23
    • 2016-10-21
    • 2019-08-02
    • 1970-01-01
    相关资源
    最近更新 更多