Heroku和Laravel护照 [英] Heroku and Laravel Passport
问题描述
我尝试在heroku上安装我的应用程序.该应用程序是带有护照"进行身份验证的php-laravel应用程序.一切在我的本地计算机(mac os)上运行良好.
I try to install my app on heroku. This app is a php-laravel app with the "passport" for the authentication. All is running fine in my local machine (mac os).
当我尝试对邮递员进行简单的发布"时,出现此错误:
When I try to do a simple 'post' with postman, I have this error :
2018-03-17T17:05:22.059708 + 00:00 app [web.1]:[2018年3月17日17:05:22 UTC] [2018-03-17 17:05:22]生产.错误:密钥路径"file:///app/storage/oauth-private.key"不存在或不可读{"exception":"[object](LogicException(code:0):Key path \" file: ////app/storage/oauth-private.key \不存在,或在/app/vendor/league/oauth2-server/src/CryptKey.php:45)上不可读:"] []
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)"} []
要设置护照,我用:
php artisan护照:安装
php artisan passport:install
然后我在heroku的数据库中看到了密钥.因此,该命令正常运行.
And I see the keys in my database in heroku. So the command worked properly.
那么这是什么错误?
我也尝试过重新生成密钥,以停止并重新启动该应用程序.没有成功.
I tried also to regenerate the keys, to stop and restart the application. Without successes.
感谢您的建议. 谢谢
多米尼克
实际上,密钥文件不是在文件夹app/storage中生成的,这就是为什么会出现此错误的原因.但是为什么不生成这些文件?
EDIT : in fact, the key files are not generated in the folder app/storage, that's why there is this error. But why these files are not generated ?
推荐答案
解决方案在这里: https://github.com/laravel/passport/issues/267
将这几行添加到您的composer.json中的"scripts"属性下,然后提交并部署到heroku中.
Add these few lines into your composer.json under the "scripts" property, then commit et deploy into heroku.
"post-install-cmd": [
"php artisan clear-compiled",
"chmod -R 777 storage",
"php artisan passport:keys"
]
但是:之后,您必须从表"oauth-clients"中删除密钥,然后使用以下命令重新生成这些密钥:
BUT : after that you have to delete the keys from the table "oauth-clients" , then regenerate these keys with :
php artisan护照:安装
php artisan passport:install
它为我工作.
希望这会有所帮助.
多米尼克
这篇关于Heroku和Laravel护照的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!