Laravel Passport-无法创建密钥文件
我在Laravel 8.0中有一个项目。该项目居住在服务器上。现在,我正在尝试使用Docker在本地环境上进行设置。
我几乎做到了,但是我在拉拉维尔/护照上有一个问题。 当我尝试运行任何工匠命令(甚至是“ PHP Artisan Passport:Keys”)时,我总是会有以下错误。
在cryptkey.php行69中: 无法从文件中读取键 file:///var/www/html/storage/oauth-private.key
所以这是正确的,因为尚未创建键。但是我无法生成新的。
即使我尝试创建它,也看起来像Laravel/Passport使用每个命令检查此键。
当命令发射时,我该如何跳过此检查。还是如何解决此问题?
谢谢。
I have a project in Laravel 8.0. This project is living on server. Now I'm trying setup it on my local environment using docker.
I almost done it but I have one issue with laravel/passport.
When I try run any artisan command (even "php artisan passport:keys") always I have following error.
In CryptKey.php line 69:
Unable to read key from file
file:///var/www/html/storage/oauth-private.key
So it's correct because keys are not created yet. But I'm not able generate new one.
It looks like laravel/passport checking this keys with every command even when I try to create it.
How can I skip this checking when command fired. Or how to fix this issue?
Thank you.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我发现了这个问题。
在 authserviceProvider 中,在 boot()方法中,以下说明:
因此,此方法不仅始终根据要求,而且在命令调用中也被触发。
要解决问题,我们需要在 $ this-> app-> make(呼叫之前添加检查。
I found the problem.
In class AuthServiceProvider in boot() method where following instructions:
So this method is always fired not only on request but on command call too.
To solve issue we need just add checking before $this->app->make( call.
该命令应在服务器上运行,如果不是创建,则有一些权限问题
最佳示例 https://www.laravelcode.com/post/laravel-8-api-authentication-using-passport-from-the-scratch
此命令应在服务器上运行
This command should run on server if not create then there is the server some permission issue
Best Example https://www.laravelcode.com/post/laravel-8-api-authentication-using-passport-from-the-scratch
This command should run on server
我认为关键本身不是生成的。因此,使用以下命令首先生成密钥。
然后运行,
如果这不起作用,则必须是许可问题。提供足够的阅读权限
存储
文件夹。在终端中尝试以下命令,I think the key itself is not generated. So use the below command to generate key first.
And then run,
If this din't work, Then It must be the permission issue. Provide enough read permission to
storage
folder. Try the below command in the terminal,