[英]Nexmo error Builder#withClaim() is meant to be used for non-registered claims, check the documentation on how to set claim “sub”
I can't generate jwt from provided claims.我无法从提供的声明中生成 jwt。 this my code:
这是我的代码:
$keypair = new \Vonage\Client\Credentials\Keypair(file_get_contents(storage_path('voip/vonage/private.key')), env('NEXMO_APPLICATION_ID'));
$client = new \Vonage\Client($keypair);
$claims = [
'exp' => strtotime(date('Y-m-d', strtotime('+24 Hours'))),
'sub' => 'apg-cs',
'acl' => [
'paths' => [
'/*/users/**' => (object) [],
'/*/conversations/**' => (object) [],
'/*/sessions/**' => (object) [],
'/*/devices/**' => (object) [],
'/*/image/**' => (object) [],
'/*/media/**' => (object) [],
'/*/applications/**' => (object) [],
'/*/push/**' => (object) [],
'/*/knocking/**' => (object) [],
'/*/legs/**' => (object) [],
]
],
];
$token = $client->generateJwt($claims);
return $token->toString();
the error:错误:
Builder#withClaim() is meant to be used for non-registered claims, check the documentation on how to set claim "sub"
when i remove the "sub" from claims, vonage will thrown error:当我从声明中删除“子”时,vonage 将抛出错误:
user:error:invalid-user
This is a bug.这是一个错误。 The JWT library we use changed quite a few things between v3 and v4, and this looks like one of them.
我们使用的 JWT 库在 v3 和 v4 之间改变了很多东西,这看起来像是其中之一。 Since the Conversation API is still considered Beta this compatibility wasn't checked, but I'll make sure it works.
由于对话 API 仍被视为测试版,因此未检查此兼容性,但我会确保它有效。
I've opened a github issue at https://github.com/Vonage/vonage-php-sdk-core/issues/276c and will get this fixed ASAP.我已经在https://github.com/Vonage/vonage-php-sdk-core/issues/276c打开了 github 问题,并将尽快修复此问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.