Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
alxndr-w committed Feb 19, 2024
2 parents f500d38 + 1918e78 commit 2a23385
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions lib/rex_api_search_it_with_gpt.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,15 @@ public function execute()
header('HTTP/1.0 401 Unauthorized');
echo 'Authentifizierung erforderlich';
exit;
} else {
// Extrahieren des Tokens aus dem Authorization Header
list($tokenType, $token) = explode(' ', rex_server('HTTP_AUTHORIZATION'), 2);
if (strcasecmp($tokenType, 'Bearer') != 0 || $token !== rex_config::get('search_it_with_gpt', 'token')) {
header('HTTP/1.0 403 Forbidden');
echo 'Ungültiger API-Key';
exit;
}
}

// Extrahieren des Tokens aus dem Authorization Header
[$tokenType, $token] = explode(' ', rex_server('HTTP_AUTHORIZATION'), 2);
if (0 != strcasecmp($tokenType, 'Bearer') || $token !== rex_config::get('search_it_with_gpt', 'token')) {
header('HTTP/1.0 403 Forbidden');
echo 'Ungültiger API-Key';
exit;
}

// Sicherstellen, dass der Content-Type Header gesetzt ist
header('Content-Type: application/json; charset=UTF-8');

Expand Down

0 comments on commit 2a23385

Please sign in to comment.