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
Most likely you skipped one or two of the following steps:
Next, register the Passport service provider in the providers array of your config/app.php configuration file:
Laravel\Passport\PassportServiceProvider::class,
The Passport service provider registers its own database migration directory with the framework, so you should migrate your database after registering the provider. The Passport migrations will create the tables your application needs to store clients and access tokens:
php artisan migrate
Only after that can you run
php artisan passport:install
Laravel 5.4 provides larger default string length which can not be allowed.
Modify AppServiceProvider.php file:
use Illuminate\Support\Facades\Schema;
Add the following line to the boot method:
public function boot(){
Schema::defaultStringLength(150);
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With