I am planning to use Laravel Passport System for the ANGULAR 6 API. Installed as per the documentation.
But I have a bit of confusion. Please try to Resolve It.
1. How to provide a token ?
This is the Correct Method?
https://stackoverflow.com/questions/54201827/how-to-use-laravel-passport-access-tokens
OR Coding LIKE is correct Method ?:
$request->request->add([
'username' => $request->email,
'grant_type' => 'password',
'client_id' => env('PASSWORD_CLIENT_ID'),
'client_secret' => env('PASSWORD_CLIENT_SECRET'),
'scope' => '',
]);
// forward the request to the OAuth token request endpoint and Return Token
$res = Route::dispatch(request()->create('oauth/token', 'POST', $this->loginCredentials($request)));
$this->api_response = json_decode($res->getContent());
return response()->json(['token' => $this->api_response,'usersDetail' => $user], 200);
Which Method need to use and Why Please Elaborate it.?
2. How to handle Refresh Token System for Angular?
Like in Refresh (Mouse button Refresh) need to Call Laravel API? How It should be? Please elaborate with Laravel and Angular Codes.
please answer this question Detaily. looking for a good Answer!!!