From c63eb7fda5ba623718a088af850a2ecbecae1d48 Mon Sep 17 00:00:00 2001 From: Christy Jacob Date: Sat, 18 Jan 2020 10:15:54 +0530 Subject: [PATCH] chore: Adapter fixes --- src/Auth/OAuth/Apple.php | 20 +++++++++++++------- src/Auth/OAuth/LinkedIn.php | 2 +- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/src/Auth/OAuth/Apple.php b/src/Auth/OAuth/Apple.php index fbe4b65b1a..4f626bef9a 100644 --- a/src/Auth/OAuth/Apple.php +++ b/src/Auth/OAuth/Apple.php @@ -14,6 +14,11 @@ class Apple extends OAuth */ protected $user = []; + /** + * @var array + */ + protected $scopes = ["name", "email"]; + /** * @return string */ @@ -27,13 +32,14 @@ class Apple extends OAuth */ public function getLoginURL(): string { - return 'https://appleid.apple.com/auth/authorize?'. - 'client_id='.urlencode($this->appID). - '&redirect_uri='.urlencode($this->callback). - '&state='.urlencode(json_encode($this->state)). - '&response_type=code'. - '&response_mode=form_post'. - '&scope=name+email'; + return 'https://appleid.apple.com/auth/authorize?'.http_build_query([ + 'client_id' => urlencode($this->appID), + 'redirect_uri' => urlencode($this->callback), + 'state' => urlencode(json_encode($this->state)), + 'response_type' => 'code', + 'response_mode' => 'form_post', + 'scope' => implode('+', $this->getScopes()) + ]); } /** diff --git a/src/Auth/OAuth/LinkedIn.php b/src/Auth/OAuth/LinkedIn.php index 101e1f09c5..954b9c6ec8 100644 --- a/src/Auth/OAuth/LinkedIn.php +++ b/src/Auth/OAuth/LinkedIn.php @@ -49,7 +49,7 @@ class LinkedIn extends OAuth 'response_type' => 'code', 'client_id' => $this->appID, 'redirect_uri' => $this->callback, - 'scope' => implode(' ', $this->scope), + 'scope' => implode(' ', $this->getScopes()), 'state' => json_encode($this->state), ]); }