Skip to content

Commit

Permalink
fix(auth): refactor to use the auth plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
adrorocker committed Sep 18, 2024
1 parent 16898a5 commit d804613
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/AbstractClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,10 @@
use AdroSoftware\UnbounceSdk\Response\FactoryInterface;
use AdroSoftware\UnbounceSdk\Response\Status;
use Http\Client\Common\HttpMethodsClientInterface;
use Http\Client\Common\Plugin\AuthenticationPlugin;
use Http\Client\Common\Plugin\BaseUriPlugin;
use Http\Client\Common\Plugin\HeaderDefaultsPlugin;
use Http\Message\Authentication\BasicAuth;
use Psr\Http\Message\ResponseInterface;

abstract class AbstractClient
Expand All @@ -42,9 +44,13 @@ public function __construct(
'User-Agent' => $this->options->getUserAgent(),
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'Authorization' => "Token {$this->token}",
])
);
$this->clientBuilder->addPlugin(
new AuthenticationPlugin(
new BasicAuth($this->token, '')
)
);
}

public function getHttpClient(): HttpMethodsClientInterface
Expand Down

0 comments on commit d804613

Please sign in to comment.