Handle token authentication using POST parameters.

Previously, only tokens from headers or GET parameters were accepted. This update adds support for tokens sent via POST parameters, ensuring compatibility with more request types and improving flexibility for clients.
This commit is contained in:
Jepp9350
2025-02-24 11:18:03 +01:00
parent da9ebbc160
commit b6a345edb2
@@ -97,10 +97,10 @@ class authentication implements authentication_i
{
// Get the token from the headers
$headers = getallheaders();
if (!isset($headers['Authorization']) && !isset($_GET['token'])) {
if (!isset($headers['Authorization']) && !isset($_GET['token']) && !isset($_POST['token'])) {
return false;
}
$token = $_GET['token'] ?? $headers['Authorization'];
$token = $_GET['token'] ?? $headers['Authorization'] ?? $_POST['token'];
// Strip the Bearer prefix (If the token is from the headers)
if (isset($headers['Authorization'])) {
$token = str_replace('Bearer ', '', $token);