Laravel 5.4 - Installing Passport

Viewed 6006

I'm trying to install passport on my Laravel 5.4 project with the help of the Laravel Documentation. But when i'm at this stage :

php artisan passport:install

I have this error :

[Illuminate\Database\QueryException]
  SQLSTATE[42S02]: Base table or view not found: 1146 Table 'lpo.oauth_clients' doesn't exist (SQL: insert into `oa
  uth_clients` (`user_id`, `name`, `secret`, `redirect`, `personal_access_client`, `password_client`, `revoked`, `upd
  ated_at`, `created_at`) values (, Laravel Personal Access Client, ruEzLmQYSK5RhfzSximBKoupaXaMcRSR4CvXET0o, http://
  localhost, 1, 0, 0, 2017-07-06 08:26:25, 2017-07-06 08:26:25))



  [PDOException]
  SQLSTATE[42S02]: Base table or view not found: 1146 Table 'lpo.oauth_clients' doesn't exist

And i should have something like this if it succeed :

Encryption keys generated successfully.
Personal access client created successfully.
Client ID: 1
Client Secret: OUA4IhQj1t3kDRuWZ6N7DQb9h1N3ccXpQw9HS2iz
Password grant client created successfully.
Client ID: 2
Client Secret: oGhkm0EPSjqxJBMkaWNZ6lIuuZoby4ev787yW6cO

I did php artisan migrate before and i had 2 new table : users and migrations.

Thanks for your help

2 Answers

Laravel 5.4 provides larger default string length which can not be allowed.

Solution :

Modify AppServiceProvider.php file:

use Illuminate\Support\Facades\Schema;

Add the following line to the boot method:

public function boot(){
    Schema::defaultStringLength(150);
}
Related