add basic authentication with user, password and api key

This commit is contained in:
2026-07-17 16:05:28 +02:00
parent d90c5887fc
commit 956aff9fe3
4 changed files with 37 additions and 9 deletions
+11
View File
@@ -8,4 +8,15 @@ class Response {
echo json_encode($data);
exit;
}
public function unauthorized(?string $data = null) {
http_response_code(401);
header('Content-Type: application/json');
header('HTTP/1.1 401 Unauthorized');
header('Content-Length: 0');
if ($data !== null && $data !== '') {
echo json_encode($data);
}
exit;
}
}