Hands-On Full Stack Web Development with Angular 6 and Laravel 5 by Fernando Monteiro

Hands-On Full Stack Web Development with Angular 6 and Laravel 5 by Fernando Monteiro

Author:Fernando Monteiro
Language: eng
Format: epub
Tags: COM051260 - COMPUTERS / Programming Languages / JavaScript, COM060160 - COMPUTERS / Web / Web Programming, COM060080 - COMPUTERS / Web / General
Publisher: Packt Publishing
Published: 2018-07-31T06:09:01+00:00


$token = auth()->login($user); return response()->json([ 'access_token' => $token, 'token_type' => 'bearer', 'expires_in' => auth()->factory()->getTTL() * 60 ], 201);

After we created a user, we returned a HTTP status code of 201 with an access_token and an expiry date.

In the login() function:

$current_user = $request->email; return response()->json([ 'access_token' => $token, 'token_type' => 'bearer', 'current_user' => $current_user, 'expires_in' => auth()->factory()->getTTL() * 60 ], 200);

Here, in the login() function, we returned the current user based on the user's email address, an access_token, and the expiry date.

In the logout() function:



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.