Skip to content
This repository has been archived by the owner on Sep 17, 2024. It is now read-only.

Commit

Permalink
SDK assumes scopes are required (#3)
Browse files Browse the repository at this point in the history
Refresh token calls fail if no scopes are passed.
  • Loading branch information
Dave Bailey authored and gregra81 committed Dec 3, 2017
1 parent 57e94fe commit 8e7c2b4
Showing 1 changed file with 1 addition and 15 deletions.
16 changes: 1 addition & 15 deletions lib/Auth/TokenFetcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,10 @@ public function __construct(
* @param array $scopes
* @param array $additionalParams
* @return array
* @throws LogicException
* @throws RuntimeException
*/
public function fetch($url, $grantType, array $scopes, array $additionalParams = [])
{
$this->validateScopesNotEmpty($scopes);

$formParams = array_merge([
'client_id' => $this->configuration->getClientId(),
'client_secret' => $this->configuration->getClientSecret(),
Expand All @@ -92,17 +89,6 @@ public function fetch($url, $grantType, array $scopes, array $additionalParams =
return json_decode($response, true);
}

/**
* @param array $scopes
* @throws LogicException
*/
public function validateScopesNotEmpty(array $scopes)
{
if (count($scopes) === 0) {
throw new LogicException('Cannot fetch token when no scopes where defined');
}
}

/**
* @param $url
* @param $body
Expand All @@ -124,4 +110,4 @@ private function makeRequest($url, $body)

return (string)$response->getBody();
}
}
}

0 comments on commit 8e7c2b4

Please sign in to comment.