oauth-private.key does not exist or is not readable
Solution 1
I found the solution Solution: In config/app.php I had to comment these lines:
/*Laravel\Passport\PassportServiceProvider::class,
App\Providers\CodeGrantProvider::class,
Spatie\Permission\PermissionServiceProvider::class,*/
Than you need to migrate the whole database again, than uncomment this line:
Laravel\Passport\PassportServiceProvider::class,
And run php artisan passport:install
my application keys weren't working so I had to do:
php artisan config:clear
php artisan key:generate
php artisan config:clear
And than I could do php artisan serve
Thanks!
Solution 2
I think that this is due to Laravel Passport, you should try the following command:
php artisan passport:install
This command will create the encryption keys needed to generate secure access tokens. In addition, the command will create "personal access" and "password grant" clients which will be used to generate access tokens
Source: https://laravel.com/docs/5.4/passport
Solution 3
I had the same problem when I updated the composer.I generated the keys again using php artisan passport:keys and it solved the problem
Solution 4
Since /storage/*.key
is in .gitignore
so if you pull the project, that might be missing the key by running php artisan passport:keys
will generate new keys for you.
Solution 5
Step 1:
Only Run if
oauth-private.key
andoauth-public.key
not exists in storage folder otherwise skip first step..
php artisan passport:install
Step 2:
Clear configration and generate key
php artisan config:clear
php artisan key:generate
php artisan config:clear
Step 3:
Change permission and owner like that :
sudo chown www-data:www-data storage/oauth-*.key
sudo chmod 600 storage/oauth-*.key
O'Niel
I love - big surprise - everything with 0 and 1. Even so much I started my first year computer science at the Karel de Grote Hogeschool. I can code in the following languages: HTML, CSS, Javascript, PHP, SQL, Bash, Java, C#, Python, and C++. From which Python and C++ are my favorite. I also know other web-technologies like AJAX, JQuery, Laravel, and Bootstrap. Currently, I'm also learning Haskell and ASM. When talking about computers themselves, I prefer open-source software like GNU/Linux, Vim,... And a Macbook. ;) But my biggest interest is computer security. I'm also a webdeveloper in my own small official business. Check it out: https://ndvibes.com
Updated on July 09, 2022Comments
-
O'Niel almost 2 years
So, I imported another project from Bitbucket and tried to launch it using
php artisan serve
, I always get this error:[LogicException] Key path "file:///var/www/html/DesignViewer5/storage/oauth-private.key" does not exist or is not readable
I don't get this error when I make a project myself, I can't run any other command. I tried 'php artisan key:generate', and got the exact same error.
I tried:
composer update
, and got this:Loading composer repositories with package information Updating dependencies (including require-dev) Package operations: 0 installs, 1 update, 0 removals - Updating spatie/laravel-permission (1.11.1 => 1.12.0) Downloading: 100% Writing lock file Generating autoload files > Illuminate\Foundation\ComposerScripts::postUpdate > php artisan optimize [LogicException] Key path "file:///var/www/html/DesignViewer5/storage/oauth-private.key" doe s not exist or is not readable Script php artisan optimize handling the post-update-cmd event returned with error code 1
Anyone knows how to fix it? Thanks!