laravelauthenticationlaravel-passport

Call to undefined method Laravel\Passport\Passport::routes()


I tried to use Laravel-passport so I installed this package in my project, but when i wanted to make route i wrote this code in the AuthServiceProvider

 public function boot()
    {
        $this->registerPolicies();
   
        Passport::routes();
 
    }

When i run php artisan route:list in the cmd i face with this error


Solution

  • Since version 11 passport's routes have been moved to a dedicated route file. You can remove the Passport::routes() call from your application's service provider.

    If you dont want to use default passport routes. you can disabled the route in register method inside AppServicerProvider

    public function register()
    {
       Passport::ignoreRoutes();
    }
    

    and you can copy the default passport routes from vendor laravel\passport\routes\web.php

    for more detail about UPGRADE read this https://github.com/laravel/passport/blob/11.x/UPGRADE.md