Install laravel passport in laravel vapor environment

1.6k views Asked by At

Installing Passport worked for the local environment of Laravel Vapor. But after deploying it to production an error occured:

Key path "file:///tmp/storage/oauth-private.key" does not exist or is not readable

After searching the error message it seems that we need to run php artisan passport:install like mentioned here.

How can we do that with Laravel Vapor? Is there a way to get access to the server via ssh?

1

There are 1 answers

0
ceejayoz On BEST ANSWER

Vapor doesn't have a permanent filesystem; each HTTP request hits a new Lambda instance.

The docs have some info on deploying Passport keys. On Vapor, your best bet is going to be using Vapor's "secrets" system to put them into the environment, then doing:

php artisan vendor:publish --tag=passport-config

which will then provide the option to load the encryption keys from your environment variables:

You'll want to name your secrets PASSPORT_PRIVATE_KEY and PASSPORT_PUBLIC_KEY in Vapor.