I’ve a web app with Laravel 7. On that application I recently created a new api.php file under a folder named api/v2 (routes/api/v2/api.php). The problem I’m facing is that on the newly created api.php file ‘auth:api’ middleware is not working.
I’ve checked the request headers and found out that authorization header is coming as empty for those routes. Everything works fine for older route file.
I’ve registered new api file inside RouteServiceProvider.php like this
Route::prefix('api/v2')
->middleware('api')
->namespace($this->namespace)
->group(base_path('routes/api/v2/api.php'));
all routes are working fine without any issues except the auth problem. due to that I cannot call ‘$request->user()’ method inside my controller.
PS: I’m using apache 2.4+
Anyone know why this is happening?