LoginSignup
1
0

More than 1 year has passed since last update.

LaravelからDropboxアクセストークン取得

Posted at

Dropboxのアクセストークンが短命化されてからリフレッシュトークンを使ってアクセストークンを取得する方法がネット探してもなかったので投稿

$http = new GuzzleHttp\Client;
$response = $http->post('https://api.dropbox.com/oauth2/token', [
    'form_params' => [
        'grant_type' => 'refresh_token',
        'refresh_token' => '(リフレッシュトークン)',
    ],
    'auth' => [ '(ユーザー)', '(パスワード)', ],
]);

結果

[
     "access_token" => "sl.BJGK.....",
     "token_type" => "bearer",
     "expires_in" => 14400, // 有効時間4時間
   ]

リフレッシュトークン取得方法はこちらを参考にして頂いた。
https://qiita.com/nkmk1215/items/2b2ed200a1c447655891

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0