fix: accept vehicle API token via header
This commit is contained in:
1 parent
629e9c5dc5
commit
5a234f2f0d
1 file changed
+4
-1
@@ -18,7 +18,10 @@ if (!in_array($clientIp, ALLOWED_IPS, true)) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$params = ($requestMethod === 'POST') ? $_POST : $_GET;
|
$params = ($requestMethod === 'POST') ? $_POST : $_GET;
|
||||||
$token = $params['token'] ?? '';
|
$headerToken = $_SERVER['HTTP_X_CAR_TOKEN'] ?? '';
|
||||||
|
$token = is_string($headerToken) && $headerToken !== ''
|
||||||
|
? $headerToken
|
||||||
|
: ($params['token'] ?? '');
|
||||||
|
|
||||||
if (!hash_equals(AUTH_TOKEN, $token)) {
|
if (!hash_equals(AUTH_TOKEN, $token)) {
|
||||||
json_exit([
|
json_exit([
|
||||||
|
|||||||
Reference in new issue
Block a user