skip to Main Content

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

  • Call to undefined method LaravelPassportPassport::routes()

2

Answers


  1. 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 laravelpassportroutesweb.php

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

    Login or Signup to reply.
  2. Remove this comment on this line on your AuthServiceProvider file.

    protected $policies = [
            'AppModelsModel' => 'AppPoliciesModelPolicy',
        ];
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search