I have a clean installation of Laravel 9.2.
composer require laravel/passport
Then I run the migrations and install passport.
php artisan migrate
php artisan passport:install
All of that should generate the necessary routes for authentication?
But route list does not have passport routes.
php artisan route:list
GET|HEAD / ......................................................................................................... POST _ignition/execute-solution .. ignition.executeSolution › Spatie\LaravelIgnition › ExecuteSolutionController GET|HEAD _ignition/health-check .............. ignition.healthCheck › Spatie\LaravelIgnition › HealthCheckController POST _ignition/update-config ........... ignition.updateConfig › Spatie\LaravelIgnition › UpdateConfigController GET|HEAD sanctum/csrf-cookie ........................................... Laravel\Sanctum › CsrfCookieController@show
Did I missed something to work it properly?
CodePudding user response:
after php artisan passport:install
you should call the Passport::routes
method within the boot method of your App\Providers\AuthServiceProvider
. This method will register the routes necessary to issue access tokens and revoke access tokens, clients, and personal access tokens:
public function boot()
{
$this->registerPolicies();
if (! $this->app->routesAreCached()) {
Passport::routes();
}
}
check the package docs for more details.