gpt4 book ai didi

laravel - Heroku 和 Laravel 护照

转载 作者:行者123 更新时间:2023-12-01 07:51:19 28 4
gpt4 key购买 nike

我尝试在 heroku 上安装我的应用程序。这个应用程序是一个 php-laravel 应用程序,带有用于身份验证的“护照”。在我的本地机器(mac os)上一切正常。

当我尝试与 postman 进行简单的“发布”时,出现以下错误:

2018-03-17T17:05:22.059708+00:00 app[web.1]: [17-Mar-2018 17:05:22 UTC] [2018-03-17 17:05:22] production.ERROR: Key path "file:///app/storage/oauth-private.key" does not exist or is not readable {"exception":"[object] (LogicException(code: 0): Key path \"file:///app/storage/oauth-private.key\" does not exist or is not readable at /app/vendor/league/oauth2-server/src/CryptKey.php:45)"} []



为了设置护照,我使用以下命令生成了 key :

php artisan passport:install



我在 heroku 的数据库中看到了键。所以命令正常工作。

那么这个错误是什么?

我还尝试重新生成 key ,停止并重新启动应用程序。没有成功。

感谢您的建议。
谢谢

多米尼克

编辑:实际上,在文件夹 app/storage 中未生成 key 文件,这就是出现此错误的原因。但是为什么没有生成这些文件呢?

最佳答案

解决方案在这里:
https://github.com/laravel/passport/issues/267

将这几行添加到“scripts”属性下的 composer.json 中,然后 commit et deploy 到 heroku。

"post-install-cmd": [ 
"php artisan clear-compiled",
"chmod -R 777 storage",
"php artisan passport:keys"
]

但是:之后,您必须从“oauth-clients”表中删除 key ,然后使用以下命令重新生成这些 key :

php artisan passport:install



它对我有用。

希望它会有所帮助。

多米尼克

关于laravel - Heroku 和 Laravel 护照,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49339711/

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