initial prototype based on nat-as-server
Some checks failed
PHPUnit / test (push) Has been cancelled
Some checks failed
PHPUnit / test (push) Has been cancelled
This commit is contained in:
18
handlers/logout.php
Normal file
18
handlers/logout.php
Normal file
@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
if ($method !== 'DELETE' && $method !== 'POST') {
|
||||
json_error('METHOD_NOT_ALLOWED', 'Method not allowed', 405);
|
||||
}
|
||||
|
||||
$token = get_bearer_token();
|
||||
if (!$token) {
|
||||
json_error('UNAUTHORIZED', 'Missing Bearer token', 401);
|
||||
}
|
||||
|
||||
try {
|
||||
token_revoke($token);
|
||||
} catch (Throwable $e) {
|
||||
qdb_handler_fail($e, 'Logout');
|
||||
}
|
||||
|
||||
json_success(['loggedOut' => true]);
|
||||
Reference in New Issue
Block a user