add basic authentication with user, password and api key
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user