Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Could not create token: Builder#withClaim() is meant to be used for non-registered claims, check the documentation on how to set claim "iss" #1

Closed
fshch opened this issue Nov 26, 2020 · 1 comment

Comments

@fshch
Copy link

fshch commented Nov 26, 2020

安装了
hyperf-ext/auth
hyperf-ext/jwt
lcobucci/jwt v3.4
登录认证的时候使用了
hyperf/vendor/hyperf-ext/auth/src/Guards/JwtGuard.php
的attempt的方法,认证成功后,会进行登录获取token,调用了
hyperf/vendor/hyperf-ext/jwt/src/Codec.php的encode方法,里面
$builder->withClaim($key, $value); 语句报了标题中的错误,
而提示的意思就是这个方法只能用于未注册的claim,$payload里面的claim都是在
vendor/lcobucci/jwt/src/Token/RegisteredClaims.php
文件中注册过的,所以报了错。
应该调整为set方法

@ericyzhu
Copy link
Member

依赖的 lcobucci/jwt 在 3.4 版本进行了一些破坏性更新以过渡到 4.0,目前发布了一个小版本来通过锁定版本号到 ~3.3.0 避免这些问题。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants