Fix auth bearer

This commit is contained in:
2026-03-16 11:02:43 -04:00
parent 5d4242dcb4
commit 05e9fbe76e

View File

@@ -34,10 +34,18 @@ if (auth_enabled()) {
$token_ok = false; $token_ok = false;
if (TRIGGER_TOKEN !== '') { if (TRIGGER_TOKEN !== '') {
$provided = ''; $provided = '';
if (function_exists('apache_request_headers')) {
$requestHeaders = apache_request_headers();
if (isset($requestHeaders['authorization'])) {
$authToken = $requestHeaders['authorization'];
$provided = substr($authToken, 7);
}
}
$auth_header = $_SERVER['HTTP_AUTHORIZATION'] ?? ''; $auth_header = $_SERVER['HTTP_AUTHORIZATION'] ?? '';
if (str_starts_with($auth_header, 'Bearer ')) { if (str_starts_with($auth_header, 'Bearer ')) {
$provided = substr($auth_header, 7); $provided = substr($auth_header, 7);
} }
if ($provided === '' && isset($_REQUEST['token'])) { if ($provided === '' && isset($_REQUEST['token'])) {
$provided = $_REQUEST['token']; $provided = $_REQUEST['token'];
} }