Skip to content

Commit

Permalink
feature: can send authorization via custom header APIKEY
Browse files Browse the repository at this point in the history
  • Loading branch information
fmancardi committed Jul 4, 2019
1 parent 6da5dff commit 13ede53
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions lib/api/rest/v2/tlRestApi.class.php
Expand Up @@ -189,12 +189,18 @@ public function __construct() {
function authenticate(\Slim\Route $route)
{
$apiKey = null;
if(is_null($apiKey))
{
if(is_null($apiKey)) {
$request = $this->app->request();
$apiKey = $request->headers('PHP_AUTH_USER');
}
$hh = $request->headers();

if( isset($hh['APIKEY']) ) {
$apiKey = $hh['APIKEY'];
} else {
$apiKey = $hh['PHP_AUTH_USER'];
}
}
echo $apiKey;
die();
$sql = "SELECT id FROM {$this->tables['users']} " .
"WHERE script_key='" . $this->db->prepare_string($apiKey) . "'";

Expand Down

0 comments on commit 13ede53

Please sign in to comment.