Skip to content
This repository was archived by the owner on Sep 17, 2024. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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();
}
}
}