app->bind(PassportAuthCodeRepository::class, AuthCodeRepository::class); $this->app->bind(PassportAccessTokenRepository::class, AccessTokenRepository::class); $this->app->bind(PassportAuthorizationController::class, AuthorizationController::class); // Passport's contextual guard binding targets its own controller class; // repeat it for our override so authorize() still receives the web guard. $this->app->when([ AuthorizationController::class, DeviceAuthorizationController::class, ])->needs(StatefulGuard::class)->give( fn () => Auth::guard(config('passport.guard', null)), ); } public function boot(): void { Passport::useTokenModel(AccessToken::class); Passport::useAuthCodeModel(AuthCode::class); // API keys may be created with no expiry. Passport still embeds a JWT // `exp`, so keep that far out and enforce the optional // oauth_access_tokens.expires_at in LoadWorkspaceFromToken instead. Passport::personalAccessTokensExpireIn(now()->addYears(100)); Passport::tokensCan([ 'mcp:use' => 'Use the MCP server', ]); Passport::authorizationView( fn (array $parameters) => $this->app->make(AuthorizationView::class)($parameters), ); } }