简体   繁体   English

"message": "关键路径 \\"file:///app/storage/oauth-private.key\\" 在 Laravel 6 中不存在或不可读"

[英]"message": "Key path \"file:///app/storage/oauth-private.key\" does not exist or is not readable" in Laravel 6

Getting error in Heroku server when try to login with Laravel passport Api.尝试使用 Laravel 护照 Api 登录时,在 Heroku 服务器中出现错误。 Migration and key generation every working fine.迁移和密钥生成一切正常。 But working fine locally.但在本地工作正常。

Can anyone help me how to generate this key in heroku server by using :任何人都可以帮助我如何使用以下命令在 heroku 服务器中生成此密钥:

heroku run php artisan passport:key

Thank you for your valuable time.感谢您的宝贵时间。 Full error message完整的错误信息

{
"message": "Key path \"file:///app/storage/oauth-private.key\" does not exist or is not readable",
"exception": "LogicException",
"file": "/app/vendor/league/oauth2-server/src/CryptKey.php",
"line": 48,
"trace": [
    {
        "file": "/app/vendor/laravel/passport/src/PassportServiceProvider.php",
        "line": 243,
        "function": "__construct",
        "class": "League\\OAuth2\\Server\\CryptKey",
        "type": "->"
    },
    {
        "file": "/app/vendor/laravel/passport/src/PassportServiceProvider.php",
        "line": 209,
        "function": "makeCryptKey",
        "class": "Laravel\\Passport\\PassportServiceProvider",
        "type": "->"
    }
]

} }

You do not mention your installation steps.你没有提到你的安装步骤。 Presume you did the following:假设您执行了以下操作:

composer require laravel/passport

Register the service provider inside config/app.php在 config/app.php 中注册服务提供者

Laravel\Passport\PassportServiceProvider::class,

Run the migrations运行迁移

php artisan migrate

Lastly generate the keys using最后使用生成密钥

php artisan passport:install

Laravel PassPort uses oauth2 which uses an asymmetric encryption algorithm. Laravel PassPort 使用使用非对称加密算法的 oauth2。 So you have to generate the public and private keys.所以你必须生成公钥和私钥。 You just have to type this command in your Laravel project to generate these keys.你只需要在你的 Laravel 项目中输入这个命令来生成这些密钥。 They will be in the storage folder.它们将位于存储文件夹中。

php artisan passport:keys

For more information, see the laravel document.有关更多信息,请参阅 laravel 文档。 Laravel Doc : https://laravel.com/docs/8.x/passport#password-grant-tokens Laravel 文档: https ://laravel.com/docs/8.x/passport#password-grant-tokens

Another solution is to go to the .gitignore file and delete the ***另一种解决方案是转到 .gitignore 文件并删除 ***

storage / *.贮存 / *。 Keys钥匙

*** line before pushing to github *** 推送到 github 之前的行

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 密钥路径“file:///home/vagrant/code/ ... /storage/oauth-private.key”不存在或不可读 - Key path “file:///home/vagrant/code/ … /storage/oauth-private.key” does not exist or is not readable Heroku“ oauth-private.key”不存在或不可读-Laravel 5 - Heroku “oauth-private.key” does not exist or is not readable - Laravel 5 oauth-private.key 在 Laravel 中不存在或不可读 - oauth-private.key does not exist or is not readable in laravel oauth-private.key 不存在或不可读 - oauth-private.key does not exist or is not readable LogicException:无法从文件中读取密钥://C:\Users\vivek\pregent-app\app\Providers/../secrets/oauth\oauth-private.key - LogicException: Unable to read key from file file://C:\Users\vivek\pregent-app\app\Providers/../secrets/oauth\oauth-private.key Laravel生产:文件“ /home/forge/default/storage/app/geoip.mmdb”不存在或不可读 - Laravel production: The file “/home/forge/default/storage/app/geoip.mmdb” does not exist or is not readable laravel 文件不存在或不可读 - laravel file does not exist or is not readable laravel 文件上传 - "" 文件不存在或不可读 - laravel file upload - The "" file does not exist or is not readable 我如何将公钥和私钥存储在 Laravel 存储应用程序文件夹中 - How i do store public key and private key in Laravel Storage app folder laravel 文件上传会引发错误“文件不存在或不可读”。 - laravel file upload throws an error “file does not exist or is not readable.”
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM