Search code examples
laravel-passportlaravel-10

Call to undefined method Laravel\Passport\Passport::routes() while upgrading laravel-passport


I upgraded laravel to 10 and also updated "laravel/passport": "^10.4" to "laravel/passport": "^11.0".

It throws error in AuthServiceProvider while executing composer update.

     20▕
     21▕         /** @var CachesRoutes $app */
     22▕         $app = $this->app;
     23▕         if (!$app->routesAreCached()) {
  ➜  24▕             Passport::routes(null, ['prefix' => 'api/oauth']);
     25▕         }
     26▕
     27▕         Passport::ignoreCsrfToken();
     28▕         Passport::hashClientSecrets();```

Solution

  • I removed Passport::routes(null, ['prefix' => 'api/oauth']); from AuthServiceProvider and added 'path' => 'api/oauth' in config/passport.php

    It's working now.