1

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::middleware('auth:api')->group(function(){
    Route::post('user', 'Api\Auth\PassportController@getDetails');
}

This working on local but not on server.

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

Don't know whats wrong. Please help me to solve this issue.

4
  • What error message are you getting, have you checked your server error logs? If it's working on local but not your production server it could be something as simple as missing some dependencies via Composer? Is the access token you are using on the server incorrect? Could be a lot of things without more code/an error log. Commented Apr 19, 2018 at 11:55
  • Yes @XanT , no logs are there, I am getting Unauthenticated message from App\Exceptions\Handler@unauthenticated class Commented Apr 19, 2018 at 12:02
  • Are you using the right token? did you set an authentication code? Commented Apr 19, 2018 at 13:03
  • yes @LuisfelipeDejesusMunoz Commented Apr 19, 2018 at 13:07

1 Answer 1

1

After hours of searching and moving many lines of code: php artisan config:clear Works for me!

Idea from: https://github.com/laravel/passport/issues/452

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.