"Type error: Argument 2 passed to Lcobucci\\JWT\\Signer\\Hmac::createHash () must be an instance of Lcobucci\\JWT\\Signer\\Key, null given, called in /home/deploy/erp/releases/7/vendor/lcobucci/jwt/src/Signer/BaseSigner.php on line 34",?

"Type error: Argument 2 passed to Lcobucci\JWT\Signer\Hmac::createHash() must be an instance of Lcobucci\JWT\Signer\Key, null given, called in /home/deploy/erp/releases/7/vendor/lcobucci/jwt/src/Signer/BaseSigner.php on line 34",
我调用接口报这个错,不能生成token

《L04 微信小程序从零到发布》
从小程序个人账户申请开始,带你一步步进行开发一个微信小程序,直到提交微信控制台上线发布。
《L02 从零构建论坛系统》
以构建论坛项目 LaraBBS 为线索,展开对 Laravel 框架的全面学习。应用程序架构思路贴近 Laravel 框架的设计哲学。
最佳答案

@ImVic ,解决了,就是.evn 没有秘钥 用 php artisan jwt:secret 这个命令

5年前 评论
讨论数量: 7
liyu001989

检查一下env里面的 JWT_SECRET 配置正确了没

5年前 评论

配置了,用的php artisan jwt:secret 这个命令,还重新装了一遍,,还是这样的。。。

5年前 评论
liyu001989

https://github.com/tymondesigns/jwt-auth/i... 应该就是这个 issue 了,确认一下是否有缓存,配置生效了没

file

5年前 评论

@liyu001989 我试了那两歌命令,还是没用,我安装的时候报了个错,不知道是不是这个原因啊?

file

5年前 评论
liyu001989

报错说的是连不上packagist.org,包信息拿的缓存,这个不是重点

file

相同的已经 close 了的 issue,代码也是这个逻辑,拿 secret 结果只是 null,所以才报这个错,问题就是 secret 的问题。你要么代码里面加日志调一下吧,我本地正常的

5年前 评论

解决了吗?我也有这个问题

5年前 评论

@ImVic ,解决了,就是.evn 没有秘钥 用 php artisan jwt:secret 这个命令

5年前 评论

讨论应以学习和精进为目的。请勿发布不友善或者负能量的内容,与人为善,比聪明更重要!