From 230b039bbd4b592cf7260e8e00ee28993b9c60c6 Mon Sep 17 00:00:00 2001 From: Christy Jacob Date: Sun, 12 Jan 2020 00:59:22 +0530 Subject: [PATCH] feat: added methods for adding and getting scopes --- src/Auth/OAuth.php | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/src/Auth/OAuth.php b/src/Auth/OAuth.php index 37f0c07dd0..5a9c1ed14f 100644 --- a/src/Auth/OAuth.php +++ b/src/Auth/OAuth.php @@ -45,8 +45,6 @@ abstract class OAuth $this->callback = $callback; $this->state = $state; $this->scopes = $scopes; - var_dump($scopes); - exit(); } /** @@ -87,7 +85,26 @@ abstract class OAuth */ abstract public function getUserName(string $accessToken):string; + /** + * @param $scope + * + * @return array + */ + protected function addScope(string $scope){ + // Add a scope to the scopes array if it isn't already present + if (!in_array($scope, $this->scopes)){ + $this->$scopes[] = $scope; + } + } + /** + * @return array + */ + protected function getScopes(){ + return $this->scopes; + } + + // The parseState function was designed specifically for Amazon OAuth Adapter to override. // The response from Amazon is html encoded and hence it needs to be html_decoded before // json_decoding