mirror of
https://github.com/appwrite/appwrite
synced 2026-05-24 09:28:40 +00:00
Fixed Bitly response parsing
This commit is contained in:
parent
a8a61701b2
commit
ecb1d21953
2 changed files with 19 additions and 7 deletions
|
|
@ -65,7 +65,7 @@ class Bitly extends OAuth2
|
||||||
protected function getTokens(string $code): array
|
protected function getTokens(string $code): array
|
||||||
{
|
{
|
||||||
if(empty($this->tokens)) {
|
if(empty($this->tokens)) {
|
||||||
$this->tokens = \json_decode($this->request(
|
$response = $this->request(
|
||||||
'POST',
|
'POST',
|
||||||
$this->resourceEndpoint . 'oauth/access_token',
|
$this->resourceEndpoint . 'oauth/access_token',
|
||||||
["Content-Type: application/x-www-form-urlencoded"],
|
["Content-Type: application/x-www-form-urlencoded"],
|
||||||
|
|
@ -76,8 +76,12 @@ class Bitly extends OAuth2
|
||||||
"redirect_uri" => $this->callback,
|
"redirect_uri" => $this->callback,
|
||||||
"state" => \json_encode($this->state)
|
"state" => \json_encode($this->state)
|
||||||
])
|
])
|
||||||
), true);
|
);
|
||||||
}
|
|
||||||
|
$output = [];
|
||||||
|
\parse_str($response, $output);
|
||||||
|
$this->tokens = $output;
|
||||||
|
}
|
||||||
|
|
||||||
return $this->tokens;
|
return $this->tokens;
|
||||||
}
|
}
|
||||||
|
|
@ -89,7 +93,7 @@ class Bitly extends OAuth2
|
||||||
*/
|
*/
|
||||||
public function refreshTokens(string $refreshToken):array
|
public function refreshTokens(string $refreshToken):array
|
||||||
{
|
{
|
||||||
$this->tokens = \json_decode($this->request(
|
$response = $this->request(
|
||||||
'POST',
|
'POST',
|
||||||
$this->resourceEndpoint . 'oauth/access_token',
|
$this->resourceEndpoint . 'oauth/access_token',
|
||||||
["Content-Type: application/x-www-form-urlencoded"],
|
["Content-Type: application/x-www-form-urlencoded"],
|
||||||
|
|
@ -99,7 +103,11 @@ class Bitly extends OAuth2
|
||||||
"refresh_token" => $refreshToken,
|
"refresh_token" => $refreshToken,
|
||||||
'grant_type' => 'refresh_token'
|
'grant_type' => 'refresh_token'
|
||||||
])
|
])
|
||||||
), true);
|
);
|
||||||
|
|
||||||
|
$output = [];
|
||||||
|
\parse_str($response, $output);
|
||||||
|
$this->tokens = $output;
|
||||||
|
|
||||||
if(empty($this->tokens['refresh_token'])) {
|
if(empty($this->tokens['refresh_token'])) {
|
||||||
$this->tokens['refresh_token'] = $refreshToken;
|
$this->tokens['refresh_token'] = $refreshToken;
|
||||||
|
|
|
||||||
|
|
@ -80,7 +80,7 @@ class Github extends OAuth2
|
||||||
*/
|
*/
|
||||||
public function refreshTokens(string $refreshToken):array
|
public function refreshTokens(string $refreshToken):array
|
||||||
{
|
{
|
||||||
$this->tokens = \json_decode($this->request(
|
$response = $this->request(
|
||||||
'POST',
|
'POST',
|
||||||
'https://github.com/login/oauth/access_token',
|
'https://github.com/login/oauth/access_token',
|
||||||
[],
|
[],
|
||||||
|
|
@ -90,7 +90,11 @@ class Github extends OAuth2
|
||||||
'grant_type' => 'refresh_token',
|
'grant_type' => 'refresh_token',
|
||||||
'refresh_token' => $refreshToken
|
'refresh_token' => $refreshToken
|
||||||
])
|
])
|
||||||
), true);
|
);
|
||||||
|
|
||||||
|
$output = [];
|
||||||
|
\parse_str($response, $output);
|
||||||
|
$this->tokens = $output;
|
||||||
|
|
||||||
if(empty($this->tokens['refresh_token'])) {
|
if(empty($this->tokens['refresh_token'])) {
|
||||||
$this->tokens['refresh_token'] = $refreshToken;
|
$this->tokens['refresh_token'] = $refreshToken;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue