From a8a61701b29c0ffdedcd3374e470ed9386afd447 Mon Sep 17 00:00:00 2001 From: Matej Baco Date: Sat, 5 Feb 2022 16:25:47 +0100 Subject: [PATCH] Fixed GitHub response parsing --- src/Appwrite/Auth/OAuth2/Github.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/Appwrite/Auth/OAuth2/Github.php b/src/Appwrite/Auth/OAuth2/Github.php index 22ffbe937f..ceda2a4740 100644 --- a/src/Appwrite/Auth/OAuth2/Github.php +++ b/src/Appwrite/Auth/OAuth2/Github.php @@ -53,7 +53,7 @@ class Github extends OAuth2 protected function getTokens(string $code): array { if(empty($this->tokens)) { - $this->tokens = \json_decode($this->request( + $response = $this->request( 'POST', 'https://github.com/login/oauth/access_token', [], @@ -63,7 +63,11 @@ class Github extends OAuth2 'client_secret' => $this->appSecret, 'code' => $code ]) - ), true); + ); + + $output = []; + \parse_str($response, $output); + $this->tokens = $output; } return $this->tokens;