summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--public/bookmarks/add/index.php5
1 files changed, 4 insertions, 1 deletions
diff --git a/public/bookmarks/add/index.php b/public/bookmarks/add/index.php
index 18db75f..5480361 100644
--- a/public/bookmarks/add/index.php
+++ b/public/bookmarks/add/index.php
@@ -9,7 +9,10 @@ $config = require_once(__DIR__.'/../../../config.php');
if ('POST' !== filter_input(INPUT_SERVER, 'REQUEST_METHOD')) {
respondAndExit(405, 'Method Not Allowed');
}
-if ('Bearer '.$config['bearer_token'] !== filter_input(INPUT_SERVER, 'HTTP_AUTHORIZATION')) {
+
+$bearerToken = getallheaders()['Authorization'] ?? null;
+
+if ('Bearer '.$config['bearer_token'] !== $bearerToken) {
respondAndExit(401, 'Unauthorized', ['WWW-Authenticate: Bearer realm="Bookmarks"']);
}