简体   繁体   English

我应该在laravel护照刷新令牌上放什么?

[英]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. 当首次为授权代码调用http://localhost/my_project/public/oauth/token ,将返回refresh_token。 This is what you need to provide for the refresh_token form parameter. 这是您需要为refresh_token表单参数提供的。

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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