Original vikon_core security.php validates tokens via: POST db-nica.ru/oauth2/resource/token/introspect Body: client_id=542&access_token=XXX Our code was incorrectly using: GET auth.db-nica.ru/api/profile_applicant/check_access_token Header: Authorization: Bearer XXX This was the WRONG endpoint — the profile check is for abitur forms, not for the update system.
29 lines
726 B
PHP
29 lines
726 B
PHP
<?php
|
|
|
|
namespace App\Containers\VikonIntegration\Tasks;
|
|
|
|
use Illuminate\Support\Facades\Log;
|
|
|
|
class ValidateTokenTask
|
|
{
|
|
public function __construct(
|
|
private readonly HttpTask $http,
|
|
private readonly string $clientId,
|
|
) {}
|
|
|
|
public function run(string $accessToken): bool
|
|
{
|
|
try {
|
|
$response = $this->http->post('oauth2/resource/token/introspect', [
|
|
'client_id' => $this->clientId,
|
|
'access_token' => $accessToken,
|
|
]);
|
|
|
|
return $response->successful();
|
|
} catch (\Throwable $e) {
|
|
Log::warning('Vikon token validation failed', ['error' => $e->getMessage()]);
|
|
return false;
|
|
}
|
|
}
|
|
}
|