Laravel 5.3 Passport JWT Authentication

前端 未结 4 1747
再見小時候
再見小時候 2020-12-23 12:31

Earlier when I was using laravel 5.2, i used a third party package https://github.com/tymondesigns/jwt-auth/ for making JWT based authentication. Where we just had to pass t

4条回答
  •  眼角桃花
    2020-12-23 13:05

    $request->user(); was not working for me because the middleware is configured to web, which I also need + api. The docs are not clear about how to control for both scenarios.

    I was able to get users details with get Auth Bearer + token, and on Laravel:

    use Illuminate\Support\Facades\Auth;
    
    Route::get('/user', function() {
       return Auth::guard('api')->user();
    });
    

提交回复
热议问题