Laravel Passport Key path oauth-public.key does not exist or is not readable

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

I see you are trying it on Windows. I saw an OpenSSL problem on Windows, might help you.


This is because you didn't generate Oauth keys using passport keys.

Run

php artisan passport:keys

After that run the following command to generate a personal access client

php artisan passport:client --personal

Enter the details it asks you. Then you are done.


May be storage/oauth-private.key and storage/oauth-private.key is absent and you imported the old database. For this scenario please run the following command.

php artisan passport:keys

Try this solution if you imported the old database where passport related data already stored. Otherwise, follow the accepted answer.


Had the same error with Ubuntu and in my case the problem was with permissions, running this solved the issue:

sudo chown www-data:www-data storage/oauth-*.key