Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

oauth-private.key does not exist or is not readable

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!

like image 596
O'Niel Avatar asked Mar 14 '17 19:03

O'Niel


2 Answers

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

like image 85
Hammerbot Avatar answered Nov 14 '22 05:11

Hammerbot


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

like image 31
Sandesh Chaudhari Avatar answered Nov 14 '22 07:11

Sandesh Chaudhari