I am using Laravel 11 new install with Passport package set up, I have created a client id and secret using client_credentials grant_type, when calling oauth/token, I get the access token and that access token works fine when I call this api in my application from third party application ( Postman )
Route::get('/api-testing', function (Request $request) {
return ['message' => 'all good'];
})->middleware('client');
However, when I deliverately pass incorrect access token using using this code:
curl --location --request GET 'http://localhost/myapplication/public/api/api-testing' \
--header 'Authorization: Bearer incorrect token'
I get the following error:
Symfony\Component\Routing\Exception\RouteNotFoundException: Route [login] not defined. in file \vendor\laravel\framework\src\Illuminate\Routing\UrlGenerator.php on line 477
I don't have route login and don't want to have it, just want to return unauthenticated message if access token is incorrect.
What am I missing?