Back

Api auth middleware is not working on serve


Mehedi Hasan Monirul posted 4 months ago

I have a Laravel 5.5 application I am able to login with API but unable to access routes with "auth:api" middleware.

Sending headers like

1 . Accept = application/json

2 . Authorization = Bearer eyJ0eXAi.....xxxxxxxx

In api.php

Route::group(['middleware' => ['auth:api'], 'prefix' => 'v1',], function(){
	Route::get('me', 'Api\[email protected]');
}

This working on local but not on server.

Checked error_log file and laravel.log file. But no luck.

Jennifer Brownz replied 3 months ago

I am having the exact same error. Is there any resolution yet?

Pardeeptech replied 3 months ago

In terminal: run php artisan route:list, if you see the 'web' middleware being applied to routes twice, remove the middleware from your group.

also You can see this in the ``` RouteServiceProvider


Sign in to participate in this thread!



We'd like to thank these amazing companies for supporting us