首页 > 解决方案 > 我应该在 laravel 护照刷新令牌中放什么?

问题描述

试图找到刷新令牌的解决方案。

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']       
   ];
}

但我不知道在刷新令牌中放什么。有人可以帮我吗?

标签: laravel

解决方案


http://localhost/my_project/public/oauth/token首次调用授权码时,将返回一个 refresh_token。这是您需要为refresh_token表单参数提供的内容。

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


推荐阅读