Skip to content

Commit

Permalink
Fix bug with token as query param
Browse files Browse the repository at this point in the history
  • Loading branch information
pelmered committed Sep 14, 2024
1 parent 5422196 commit 09815cc
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/Credentials.php
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,11 @@ public function addAuthToRequest(PendingRequest $httpClient, Options $options):

}
if ($this->token) {
if ($options->authType === self::AUTH_TYPE_QUERY) {
return $httpClient->withQueryParameters([
$options->tokenName => $this->token,
]);
}
return $httpClient->withToken($this->token, $options->authType);
}
if ($options->authType === self::AUTH_TYPE_BASIC) {
Expand All @@ -124,11 +129,6 @@ public function addAuthToRequest(PendingRequest $httpClient, Options $options):

return $httpClient->withBasicAuth($this->clientId, $this->clientSecret);
}
if ($options->authType === self::AUTH_TYPE_QUERY && $this->token) {
return $httpClient->withQueryParameters([
$options->tokenName => $this->token,
]);
}
if ($options->authType === self::AUTH_TYPE_CUSTOM && is_callable($this->customCallback)) {
return ($this->customCallback)($httpClient);
}
Expand Down

0 comments on commit 09815cc

Please sign in to comment.