lundi 20 février 2017

Get Password Grant Tokens without http request for Laravel passport

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://ift.tt/2bNphcg', [
        '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?



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2lmhh71
via IFTTT

Aucun commentaire:

Enregistrer un commentaire