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

O'Niel picture O'Niel · Mar 14, 2017 · Viewed 35k times · Source

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!

Answer

Hammerbot picture Hammerbot · Mar 14, 2017

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