21 lines
516 B
PHP
21 lines
516 B
PHP
<?php
|
|
require __DIR__ . '/_bootstrap.php';
|
|
|
|
/**
|
|
* @OA\Post(
|
|
* path="/logout.php",
|
|
* tags={"Auth"},
|
|
* summary="Revoke current token",
|
|
* security={{"bearerAuth":{}}},
|
|
* @OA\Response(response=200, ref="#/components/responses/Success"),
|
|
* @OA\Response(response=401, ref="#/components/responses/Unauthorized")
|
|
* )
|
|
*/
|
|
require_method('POST');
|
|
require_auth($pdo);
|
|
|
|
$token = bearer_token();
|
|
$pdo->prepare('DELETE FROM api_tokens WHERE token = ?')->execute([hash('sha256', (string) $token)]);
|
|
|
|
json_ok();
|