gpt4 book ai didi

php - 无法在 Tymon JWT 中添加自定义声明

转载 作者:可可西里 更新时间:2023-10-31 23:16:06 27 4
gpt4 key购买 nike

我正在使用 Tymon JWT 在 Laravel 中生成我的 token 。我已按照 Tymon's github site 中的指南进行操作像这样小心地添加我的自定义声明:

$customClaims = ['foo' => 'bar', 'baz' => 'bob'];
JWTAuth::attempt($credentials, $customClaims);

我在对用户进行身份验证后设法生成了一个 token ,但是当我使用 JWT 解码器解码 token 时,我只看到默认声明,但看不到我的自定义声明。

最佳答案

您可能正在使用 Tymon JWT 1.0.0 版?

来自 Github Tymon JWT

For version 0.5.* See the WIKI for documentation.

Documentation for 1.0.0 is coming soon, but there is an unfinished guide here

使用

JWTAuth::customClaims(['foo' => 'bar'])->attempt(['login' => '', 'password' => '']);

关于php - 无法在 Tymon JWT 中添加自定义声明,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41572016/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com