Reputation: 340
I am working with Laravel's Passport library and using password grant type to generate access tokens. The token expiration time has been set to 10 min.
Now my problem is that when token gets expired user gets
MethodNotAllowedHttpException
instead invalid access token response.
Please help, here is my api route code.
Route::group(['middleware' => ['auth:api']], function () {
Route::get('see_your_progress/{family_id}', 'Api\v1\FamilyController@familyProgress');
});
Here is what I am getting in my postman API call,
Expected is to show JSON response saying
{error:"Unauthenticated"}
.
Please let me know if you need any more clarification.
Thanks
Upvotes: 2
Views: 658
Reputation: 340
I found the solution for my problem that, When I was hitting my route in Laravel it was route collection was getting confused whether it should call web route or api route. To solve this we have to call api with following headers.
Content-Type:application/json
Accept:application/json
Thanks
Upvotes: 3