Laravel 5.4 - Setting Passport

I am trying to install passport to my Laravel 5.4 project using Laravel Documentation. But when I am 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 end up with something like this if it does:

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 it php artisan migrate

before and I had 2 new tables: users and migrations.

thanks for the help

+3


source to share


2 answers


You have most likely missed one or two of the following steps:

Then register your Passport service provider in the provider array of the config / app.php configuration file:

Laravel\Passport\PassportServiceProvider::class,

      

The Passport provider registers its own database migration directory with the framework, so you must migrate your database after registering the provider. Passport migration will create tables in which your application should store clients and access tokens:



php artisan migrate

      

Only then can you run

php passport:install

      

+2


source


Laravel 5.4 provides long default line lengths that cannot be resolved.

Decision:

Modify the AppServiceProvider.php file :



use Illuminate\Support\Facades\Schema;

      

Add the following procedure to your boot method:

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

      

0


source







All Articles