chore: dropbox adapter changes

This commit is contained in:
Christy Jacob 2020-01-18 19:29:35 +05:30
parent 1e4fe08901
commit 5b5c178b03

View file

@ -14,6 +14,11 @@ class Dropbox extends OAuth
*/ */
protected $user = []; protected $user = [];
/**
* @var array
*/
protected $scopes = [];
/** /**
* @return string * @return string
*/ */
@ -27,11 +32,12 @@ class Dropbox extends OAuth
*/ */
public function getLoginURL(): string public function getLoginURL(): string
{ {
return 'https://www.dropbox.com/oauth2/authorize?'. return 'https://www.dropbox.com/oauth2/authorize?'.http_build_query([
'client_id='.urlencode($this->appID). 'client_id' => $this->appID,
'&redirect_uri='.urlencode($this->callback). 'redirect_uri' => $this->callback,
'&state='.urlencode(json_encode($this->state)). 'state' => json_encode($this->state),
'&response_type=code'; 'response_type' => 'code'
]);
} }
/** /**
@ -46,11 +52,13 @@ class Dropbox extends OAuth
'POST', 'POST',
'https://api.dropboxapi.com/oauth2/token', 'https://api.dropboxapi.com/oauth2/token',
$headers, $headers,
'code='.urlencode($code). http_build_query([
'&client_id='.urlencode($this->appID). 'code' => $code,
'&client_secret='.urlencode($this->appSecret). 'client_id' => $this->appID,
'&redirect_uri='.urlencode($this->callback). 'client_secret' => $this->appSecret,
'&grant_type=authorization_code' 'redirect_uri' => $this->callback,
'grant_type' => 'authorization_code'
])
); );
$accessToken = json_decode($accessToken, true); $accessToken = json_decode($accessToken, true);