Skip to content

Commit

Permalink
allow use of X-Auth-ID and X-Auth-Key headers for authentication (vs …
Browse files Browse the repository at this point in the history
…post data)
  • Loading branch information
brookgagnon committed Aug 25, 2024
1 parent 130c474 commit a704c18
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions api.php
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,12 @@ public function __construct()
}
}

// try to get an ID/key pair for user authorization.
if (!empty($_POST['i']) && !empty($_POST['k'])) {
if (!empty($_SERVER['HTTP_X_AUTH_ID']) && !empty($_SERVER['HTTP_X_AUTH_KEY'])) {
// first check X-Auth-ID and X-Auth-Key headers for user authorization.
$auth_id = $_SERVER['HTTP_X_AUTH_ID'];
$auth_key = $_SERVER['HTTP_X_AUTH_KEY'];
} elseif (!empty($_POST['i']) && !empty($_POST['k'])) {
// next try i and k post data for user authorization.
$auth_id = $_POST['i'];
$auth_key = $_POST['k'];
}
Expand Down

0 comments on commit a704c18

Please sign in to comment.