I have a standard Passara Passport setting of 5.4 - everything works fine and generates tokens.
I protect the API routes using the auth: api middleware, as well as a custom middleware that checks that certain headers in the request are present and valid before any requests are processed. This middleware works great for the API route group.
Is there a way to wrap Passport routes created by laravel '... / oauth / token' in this middleware?
I have currently configured the routes in my AuthServiceProvider.php boot () method:
public function boot()
{
$this->registerPolicies();
Passport::routes(function ($router) {
$router->forAccessTokens();
$router->forTransientTokens();
});
Passport::tokensExpireIn(Carbon::now()->addDays(7));
Passport::refreshTokensExpireIn(Carbon::now()->addDays(30));
}
, oauth , .