What is this?
Route::middleware('client')->get('/application', 'ApplicationController@index', function (Request $request) { });
It should be just
Route::get('/application', 'ApplicationController@index')->middleware('client');
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Hi,
I am trying to get the Laravel Passport Client Credentials Oauth flow working but i don't know how to call an existing controller when coming in on an API client middleware authentication Route. Does anyone know what i'm doing wrong here? I am trying to call the ApplicationController@index method and let that handle the API return. I have setup the CheckClientCredentials middleware in the app/Http/Kernel.php according to the documentation. This just returns the html login page view and never gets to the ApplicationController that i am trying to access.
Route::middleware('client')->get('/application', 'ApplicationController@index', function (Request $request) { });
Thanks!
Please or to participate in this conversation.