簡體   English   中英

我應該在laravel護照刷新令牌上放什么?

[英]What should I put at laravel passport 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']       
   ];
}

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

當首次為授權代碼調用http://localhost/my_project/public/oauth/token ,將返回refresh_token。 這是您需要為refresh_token表單參數提供的。

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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM