From 5b5c178b037b31fdfdccd4c54beb17a5b35ce49f Mon Sep 17 00:00:00 2001 From: Christy Jacob Date: Sat, 18 Jan 2020 19:29:35 +0530 Subject: [PATCH] chore: dropbox adapter changes --- src/Auth/OAuth/Dropbox.php | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/src/Auth/OAuth/Dropbox.php b/src/Auth/OAuth/Dropbox.php index a4a6335f36..85843718da 100644 --- a/src/Auth/OAuth/Dropbox.php +++ b/src/Auth/OAuth/Dropbox.php @@ -14,6 +14,11 @@ class Dropbox extends OAuth */ protected $user = []; + /** + * @var array + */ + protected $scopes = []; + /** * @return string */ @@ -27,11 +32,12 @@ class Dropbox extends OAuth */ public function getLoginURL(): string { - return 'https://www.dropbox.com/oauth2/authorize?'. - 'client_id='.urlencode($this->appID). - '&redirect_uri='.urlencode($this->callback). - '&state='.urlencode(json_encode($this->state)). - '&response_type=code'; + return 'https://www.dropbox.com/oauth2/authorize?'.http_build_query([ + 'client_id' => $this->appID, + 'redirect_uri' => $this->callback, + 'state' => json_encode($this->state), + 'response_type' => 'code' + ]); } /** @@ -46,11 +52,13 @@ class Dropbox extends OAuth 'POST', 'https://api.dropboxapi.com/oauth2/token', $headers, - 'code='.urlencode($code). - '&client_id='.urlencode($this->appID). - '&client_secret='.urlencode($this->appSecret). - '&redirect_uri='.urlencode($this->callback). - '&grant_type=authorization_code' + http_build_query([ + 'code' => $code, + 'client_id' => $this->appID, + 'client_secret' => $this->appSecret, + 'redirect_uri' => $this->callback, + 'grant_type' => 'authorization_code' + ]) ); $accessToken = json_decode($accessToken, true);