From fdab2e28e9f4c75f495069ad820451668e277628 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matej=20Ba=C4=8Do?= Date: Thu, 23 Jun 2022 08:48:59 +0000 Subject: [PATCH] Bug fixing --- src/Appwrite/Auth/OAuth2/Autodesk.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/Appwrite/Auth/OAuth2/Autodesk.php b/src/Appwrite/Auth/OAuth2/Autodesk.php index 7e0ca08d7e..0b268ead3b 100644 --- a/src/Appwrite/Auth/OAuth2/Autodesk.php +++ b/src/Appwrite/Auth/OAuth2/Autodesk.php @@ -38,6 +38,8 @@ class Autodesk extends OAuth2 { return 'https://developer.api.autodesk.com/authentication/v1/authorize?' . \http_build_query([ 'client_id' => $this->appID, + 'scope' => \implode(' ', $this->getScopes()), + 'state' => \json_encode($this->state), 'redirect_uri' => $this->callback, 'response_type' => 'code' ]); @@ -51,10 +53,11 @@ class Autodesk extends OAuth2 protected function getTokens(string $code): array { if (empty($this->tokens)) { + $headers = ['Content-Type: application/x-www-form-urlencoded']; $response = $this->request( 'POST', 'https://developer.api.autodesk.com/authentication/v1/gettoken', - [], + $headers, \http_build_query([ 'client_id' => $this->appID, 'redirect_uri' => $this->callback, @@ -64,9 +67,7 @@ class Autodesk extends OAuth2 ]) ); - $output = []; - \parse_str($response, $output); - $this->tokens = $output; + $this->tokens = \json_decode($response, true); } return $this->tokens;