File tree Expand file tree Collapse file tree 1 file changed +3
-12
lines changed
app/Http/Controllers/Auth Expand file tree Collapse file tree 1 file changed +3
-12
lines changed Original file line number Diff line number Diff line change @@ -46,7 +46,7 @@ public function login(Request $request)
4646 {
4747 $ credentials = $ request ->only ('name ' , 'password ' );
4848
49- if ($ token = $ this -> guard ()-> attempt ($ credentials )) {
49+ if ($ token = JWTAuth:: attempt ($ credentials )) {
5050 return $ this ->respondWithToken ($ token );
5151 }
5252
@@ -65,17 +65,8 @@ protected function respondWithToken($token)
6565 return response ()->json ([
6666 'access_token ' => $ token ,
6767 'token_type ' => 'bearer ' ,
68- 'expires_in ' => $ this ->guard ()->factory ()->getTTL () * 60
68+ 'expires_in ' => $ this ->guard ()->factory ()->getTTL () * 60 ,
69+ 'user ' => Auth::user (),
6970 ]);
7071 }
71-
72- /**
73- * Get the guard to be used during authentication.
74- *
75- * @return \Illuminate\Contracts\Auth\Guard
76- */
77- public function guard ()
78- {
79- return Auth::guard ('api ' );
80- }
8172}
You can’t perform that action at this time.
0 commit comments