Password Laravel Personal/Password Access Client Not Found
byWe must have stumbled on Laravel’s passport sometime for creating authentication api’s for our mobile apps providing full OAuth2 server implementation.
This post uses Laravel 7.x. Our passport installation is
composer require laravel/passport “~9.0”
We will perform the migration where Passport migrations will create the tables our application needs to store clients and access tokens. It will also create Users table for us.
php artisan migrate
We also updated the driver to use passport in config/auth.php
‘api’ => [
‘driver’ => ‘passport’,
‘provider’ => ‘users’,
‘hash’ => false,
],
Now in our registration api example when we try to generate access token
$user->createToken(‘MyApp Password Grant Client’)->accessToken;
It gives error:
Auth driver [passport] for guard [api] is not defined.
Personal access client not found.