gpt4 book ai didi

Symfony 5 Heroku 无法从给定配置创建签名的 JWT

转载 作者:行者123 更新时间:2023-12-05 09:03:17 33 4
gpt4 key购买 nike

所以,我在 Heroku 中部署了一个 JWT 项目,但出现以下错误

 Uncaught PHP Exception Lexik\Bundle\JWTAuthenticationBundle\Exception\JWTEncodeFailureException: "Unable to create a signed JWT from the given configuration." at /app/vendor/lexik/jwt-authentication-bundle/Encoder/LcobucciJWTEncoder.php line 38

.环境

APP_ENV=prod
APP_SECRET=4b3623b38e2d6ba78fe9vdfx59dc3dd5
JWT_SECRET_KEY=%kernel.project_dir%/config/jwt/private.pem
JWT_PUBLIC_KEY=%kernel.project_dir%/config/jwt/public.pem
JWT_PASSPHRASE=pass
DATABASE_URL="sqlite:///%kernel.project_dir%/var/task.db"

在 git cmd 中我也做了,但没有成功。

heroku config:set APP_ENV=prod
heroku config:set JWT_SECRET_KEY=%kernel.project_dir%/config/jwt/private.pem
etc

在 localhost 中运行良好,JWT Token 生成正常,但在 heroku 中出现上述错误。

最佳答案

如果您使用过 lexit,您是否考虑过在您的生产环境中重新生成您的私钥和公钥?

php bin/console lexik:jwt:generate-keypair    

关于Symfony 5 Heroku 无法从给定配置创建签名的 JWT,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/70107071/

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