api身份验证中间件无法在服务中使用

api身份验证中间件无法在服务中使用

问题描述:

我有一个Laravel 5.5应用程序 我可以使用API​​登录,但无法使用"auth:api"中间件访问路由.

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

发送标题,如

1.接受= application/json

1 . Accept = application/json

2.授权= Bearer eyJ0eXAi ..... xxxxxxxx

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

在api.php中

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

这在本地但不在服务器上工作.

This working on local but not on server.

检查了error_log文件和laravel.log文件.但没有运气.

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

不知道怎么了. 请帮我解决这个问题.

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

经过数小时的搜索并移动了许多行代码: php artisan config:clear 为我工作!

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

想法来自: https://github.com/laravel/passport/issues/452