2

Getting error in Heroku server when try to login with Laravel passport Api. 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 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": "->"
    }
]

}

3
  • Can you include the full error message in the body of the post? Commented Dec 24, 2019 at 3:58
  • added response from server in Postman. Commented Dec 24, 2019 at 4:07
  • login to the heroku terminal, and check is the file exists or not Commented Dec 24, 2019 at 6:38

2 Answers 2

3

You do not mention your installation steps. Presume you did the following:

composer require laravel/passport

Register the service provider inside config/app.php

Laravel\Passport\PassportServiceProvider::class,

Run the migrations

php artisan migrate

Lastly generate the keys using

php artisan passport:install
Sign up to request clarification or add additional context in comments.

3 Comments

I did these all the things
not working. This is the initial step, I have done it but error is same
please mark as verified this answer if its help for you thank you @Ajoy
1

Laravel PassPort uses oauth2 which uses an asymmetric encryption algorithm. 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. They will be in the storage folder.

php artisan passport:keys

For more information, see the laravel document. Laravel Doc : https://laravel.com/docs/8.x/passport#password-grant-tokens

Another solution is to go to the .gitignore file and delete the ***

storage / *. Keys

*** line before pushing to github

1 Comment

Please include some explanation with your answer - one-liners are useful, but it doesn't help the person asking the question as much as a full answer should.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.