简体   繁体   中英

What should I put at laravel passport refresh token?

trying to find a solution for refresh token.

public function refresh()
{
   $http = new Client();

   $response = $http->post('http://localhost/my_project/public/oauth/token', [
              'form_params' => [
                    'grant_type'    => 'refresh_token',
                    'client_id' => 1,
                    'client_secret' => '*******',
                    'refresh_token' => '',
                    'scope'         => '*',
                ],
            ]);

   $data = json_decode((string)$response->getBody(), true);

   return [
      'access_token' => $data['access_token'],
      'expires_in'   => $data['expires_in']       
   ];
}

But I don't know what to put at refresh token. Can somebody help me please ?

When http://localhost/my_project/public/oauth/token is first called for the authorization_code, a refresh_token will be returned. This is what you need to provide for the refresh_token form parameter.

Reference: https://laravel.com/docs/5.8/passport#refreshing-tokens

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM