"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

《L01 基础入门》
我们将带你从零开发一个项目并部署到线上,本课程教授 Web 开发中专业、实用的技能,如 Git 工作流、Laravel Mix 前端工作流等。
《L03 构架 API 服务器》
你将学到如 RESTFul 设计风格、PostMan 的使用、OAuth 流程,JWT 概念及使用 和 API 开发相关的进阶知识。
最佳答案

@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年前 评论

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