Fixed api header authorization (#6399)

This commit is contained in:
SamTV12345 2024-05-22 21:16:19 +02:00 committed by GitHub
parent 8cd2ed07ba
commit 63e9b2d4eb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 4848 additions and 3834 deletions

View file

@ -153,6 +153,7 @@ type APIFields = {
api_key: string;
padID: string;
padName: string;
authorization: string;
}
/**
@ -179,7 +180,7 @@ exports.handle = async function (apiVersion: string, functionName: string, field
}
if (apikey !== null && apikey.trim().length > 0) {
fields.apikey = fields.apikey || fields.api_key;
fields.apikey = fields.apikey || fields.api_key || fields.authorization;
// API key is configured, check if it is valid
if (fields.apikey !== apikey!.trim()) {
throw new createHTTPError.Unauthorized('no or wrong API Key');