FIX: Authorization en FastCGI

This commit is contained in:
Juan Pablo Vial
2025-06-27 18:00:45 -04:00
parent 352e33179c
commit 1bbee1121b
3 changed files with 21 additions and 6 deletions

View File

@ -10,7 +10,7 @@ class Login
{
public function __construct(protected ClientInterface $client, protected LoggerInterface $logger,
protected string $tokenFilename,
protected string $username, protected string $password) {}
protected string $username, protected string $password, protected string $apiKey) {}
public function login(): string
{
@ -84,8 +84,11 @@ class Login
}
return $response->getStatusCode() === 200;
}
public function getKey(string $apiKey, string $separator = 'g'): string
public function getKey(?string $apiKey = null, string $separator = 'g'): string
{
if ($apiKey === null) {
$apiKey = $this->apiKey;
}
try {
$savedToken = $this->retrieveToken();
$token = implode('', [md5($apiKey), $separator, $savedToken]);