diff --git a/src/Credentials.php b/src/Credentials.php index 2904f63..8426ec0 100644 --- a/src/Credentials.php +++ b/src/Credentials.php @@ -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) { @@ -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); }