From 0e7e2f2d71a84b51f1f1fd284c7ee8cb19c078c4 Mon Sep 17 00:00:00 2001 From: Jonathan Date: Wed, 22 Nov 2023 11:11:58 +0100 Subject: [PATCH] use api_type to switch parameters for authentications methods --- src/Builder/Client.php | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/src/Builder/Client.php b/src/Builder/Client.php index 078c2ed..9f5069b 100644 --- a/src/Builder/Client.php +++ b/src/Builder/Client.php @@ -167,20 +167,33 @@ private function getFactoryMethod(): string private function getFactoryArguments(): array { if (null !== $this->password) { + if ($this->apiType === ApiType::LEGACY->value) { + return [ + $this->clientId, + $this->secret, + $this->username, + $this->password, + ]; + } + return [ - $this->clientId, - $this->secret, $this->username, $this->password, ]; } if (null !== $this->refreshToken) { + if ($this->apiType === ApiType::LEGACY->value) { + return [ + $this->clientId, + $this->secret, + $this->token, + $this->refreshToken, + ]; + } + return [ - $this->clientId, - $this->secret, $this->token, - $this->refreshToken, ]; }