20 lines
720 B
PHP
20 lines
720 B
PHP
<?php
|
|
declare(strict_types=1);
|
|
|
|
require_once dirname(__DIR__, 4) . '/backend/JwtToken.php';
|
|
require_once dirname(__DIR__, 4) . '/backend/ApiAuth.php';
|
|
require_once dirname(__DIR__) . '/_bootstrap.php';
|
|
api_method('POST');
|
|
$auth = ApiAuth::bearerClaims();
|
|
try {
|
|
$db = Database::getInstance();
|
|
$stmt = $db->prepare('UPDATE auth_sessions SET revoked_at = COALESCE(revoked_at, UTC_TIMESTAMP()) WHERE session_uuid = ?');
|
|
$stmt->bind_param('s', $auth['session_id']);
|
|
$stmt->execute();
|
|
$stmt->close();
|
|
api_json(['status' => 'signed_out']);
|
|
} catch (Throwable $exception) {
|
|
error_log('Session revocation failed: ' . $exception->getMessage());
|
|
api_json(['error' => 'service_unavailable'], 503);
|
|
}
|