Reputation: 332
I am using Laravel 5.5 with JWT dev-develop
. I have also set my auth drivers for web.
'defaults' => [
'guard' => 'web',
'passwords' => 'users',
],
'guards' => [
'web' => [
'driver' => 'session',
'provider' => 'users',
],
'api' => [
'driver' => 'jwt',
'provider' => 'users',
],
],
But, the above configuration doesn't give me JWT Bearer Token. When I replace web
with api
, Auth::attempt($credentials)
gives me JWT token instead of session.
Any ideas how to use both at the same time?
Upvotes: 0
Views: 2290
Reputation: 34924
Auth::attempt($credentials)
override actual method when you using JWT
and giving you JWT Token.
You can also check this function in tymon\src\JWTAuth.php
You can both as use default guard
as as web
and use
JWTAuth::attempt($credentials)
to get JWT Token
Upvotes: 1