I am developing an REST API using Laravel 5.4 (passport).
I want the user to get the access token on signup without making another http request. i have gone thorough Laravel documentation. but there is no direct way to get the access token. something like:-
$token = $user->getOathToken($user_id);
Passport documentation for password grant token
In documentation they provide something like this:
$http = new GuzzleHttp\Client;
$response = $http->post('http://your-app.com/oauth/token', [
'form_params' => [
'grant_type' => 'refresh_token',
'refresh_token' => 'the-refresh-token',
'client_id' => 'client-id',
'client_secret' => 'client-secret',
'scope' => '',
],
]);
return json_decode((string) $response->getBody(), true);
I don't want to make another http request. is there any way to avoid it?