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:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user