Skip to content

Commit

Permalink
Use the defaultAuth method or the `->authenticate(new TokenAuthentica…
Browse files Browse the repository at this point in the history
…tor)` instead.
  • Loading branch information
njoguamos committed Apr 7, 2024
1 parent 8747ef0 commit 4129bcb
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/Connectors/PlausibleConnector.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use Illuminate\Support\Facades\Cache;
use Saloon\CachePlugin\Traits\HasCaching;
use Saloon\Http\Auth\TokenAuthenticator;
use Saloon\Http\Connector;
use Saloon\CachePlugin\Contracts\Driver;
use Saloon\CachePlugin\Drivers\LaravelCacheDriver;
Expand All @@ -13,9 +14,16 @@ class PlausibleConnector extends Connector implements Cacheable
{
use HasCaching;

protected ?string $token;

public function __construct()
{
$this->withTokenAuth(token: config(key: 'plausible.api_key'));
$this->token = config(key: 'plausible.api_key');
}

protected function defaultAuth(): TokenAuthenticator
{
return new TokenAuthenticator($this->token);
}

public function resolveBaseUrl(): string
Expand Down

0 comments on commit 4129bcb

Please sign in to comment.