New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Key generation for Heroku deployments #267
Comments
I have the exact same error. The keys are well into the storage/ folder. Did you find a solution to this problem ? Thank you ! |
You have two choices: 2- Create the keys somewhere and keep them safe and deploy them on your server so only the admins have access to those keys. Recommended solution What I did is that created keys and kept them safe in a lock with other keys and It solved the issue |
The problem is when I run php artisan passport:key on bash of my server, the keys was created. But when I exit the bash of my server the keys are deleted. I think its because the .gitignore file. If you remove the *.key from .gitignore, enter the bash, remove the keys and create other ones, its work but everytime you deploy your app you will need to do this. |
I have some other way to do this? |
Adding this to composer.json did the trick for me: |
@Raitch have you noticed any issues with this? My concern is regenerating the keys each deploy might log out users or causing encryption issues. |
@corbanb @DanTheDJ @mabumusa1 @marcospaegle run via terminal cli i tried and worked |
@Raitch Man thanks for that, still works on latest Laravel and Passport, fixed my issue with file permissions. |
I found a solution |
This worked!! Thanks @erlangp |
@dwinjnr @erlangp I tried this solution and also worked for me, but after an hour or 2 (don't know exactly), the keys are deleted, so I need to run the lines again on terminal cli. Any ideas? Did you have problems with that too? |
@gtox14, I experienced the same thing. I had to add the script below to composer.json ` ` |
@dwinjnr I added those lines and that generated me a failed deploy on Heroku. Any idea? |
|
Works fine for me, I removed the "php artisan optimize" becouse i have an error with routes. Thanks |
sois un pro! Terrific |
Thanks bro it works for me too! |
exactly the same problem. any solution? |
I solved this issue by using some custom artisan commands, they are now part of my project but you can grab them. The process overview:
Step 1Generate OAuth keys ( if you don't already have some )
Step 2Generate an encryption key and add the
add to your local
Step 3Encrypt your OAuth keys and commit to VCS
Commit Step 4Add
DONE! |
After doing all this. I got the way that I think is better, and I think it sounds good practice because It is on Laravel official site, click here. |
I have same issue. In fact I've got these error:
|
@hendisantika |
i am sorry.. i think the problem come because of this heroku behavior: https://help.heroku.com/K1PPS2WM/why-are-my-file-uploads-missing-deleted |
@felipemeddeiros Thanks... Docs says:
then we can set on heroku env:
|
Worked for me.. Thank you |
This will put your security-sensitive keys into your version control unencrypted. You should only do this if you understand but still accept the risk. |
@squareborg I agree, the key should not be stored in the version control |
I think this is the best solution as it is the proposed solution via the docs. Super easy to set up too. Just add your keys to your heroku config, run the above command, and commit the new files created to master. |
Thank god, It saves my life!!!! |
where can I obtain the private key here? |
You need to run "passport:install" to get these keys. I think "key:generate" can do as well. |
@irvv17 generate locally using then open folder in your project folder, open terminal/cmd run:
(more about heroku config/env https://devcenter.heroku.com/articles/config-vars) |
Thank you... sorry, noob with APIS in Laravel and deploy with heroku. |
hello @erlangp @irvv17 @felipemeddeiros can you'll help me with this? :) i already follow the steps on how to generate and put the oauth key into heroku config. btw. the way i put the aouth key into heroku config is manually. other heroku config key values.. Hope you'll help me bru. thanks! |
@reachmesidyan I think the problem is here.
|
I'm having this same problem. I am a Heroku expert and I have no idea whats wrong. My gut feeling is its in the code for the rescue app I've inherited. config/passport.php<?php
return [
/*
|--------------------------------------------------------------------------
| Encryption Keys
|--------------------------------------------------------------------------
|
| Passport uses encryption keys while generating secure access tokens for
| your application. By default, the keys are stored as local files but
| can be set via environment variables when that is more convenient.
|
*/
'private_key' => env('PASSPORT_PRIVATE_KEY'),
'public_key' => env('PASSPORT_PUBLIC_KEY'),
/*
|--------------------------------------------------------------------------
| Client UUIDs
|--------------------------------------------------------------------------
|
| By default, Passport uses auto-incrementing primary keys when assigning
| IDs to clients. However, if Passport is installed using the provided
| --uuids switch, this will be set to "true" and UUIDs will be used.
|
*/
'client_uuids' => false,
/*
|--------------------------------------------------------------------------
| Personal Access Client
|--------------------------------------------------------------------------
|
| If you enable client hashing, you should set the personal access client
| ID and unhashed secret within your environment file. The values will
| get used while issuing fresh personal access tokens to your users.
|
*/
'personal_access_client' => [
'id' => env('PASSPORT_PERSONAL_ACCESS_CLIENT_ID'),
'secret' => env('PASSPORT_PERSONAL_ACCESS_CLIENT_SECRET'),
],
/*
|--------------------------------------------------------------------------
| Passport Storage Driver
|--------------------------------------------------------------------------
|
| This configuration value allows you to customize the storage options
| for Passport, such as the database connection that should be used
| by Passport's internal database models which store tokens, etc.
|
*/
'storage' => [
'database' => [
'connection' => env('DB_CONNECTION', 'pgsql'),
],
],
]; Environment variables load in a
|
@danielricecodes on
?? More info: source code about how Passport get the keys from config: passport/src/PassportServiceProvider.php Line 255 in 4e53f1b
|
After following these procedures, I encountered an error heroku run php artisan passport:install |
@benjamintemitope |
This work for me, I use php8.1 and laravel8 |
I went through a couple of issues reported on a similar issue where the solution was to install
openssl
, I tried several solutions including creating the keys manually but the issue persisted.When I run
passport:keys
it show a success message as if it works but when I go through the files I can not find the keys created.I am running on dokku with
openssl
installed, here are the checks I didI always get this issue
Key path "file:///app/storage/oauth-private.key" does not exist or is not readable
The text was updated successfully, but these errors were encountered: