Add support for bearer auth (#1488) (#1490)

Co-authored-by: Tomas Della Vedova <delvedor@users.noreply.github.com>
This commit is contained in:
github-actions[bot]
2021-07-13 09:40:06 +02:00
committed by GitHub
parent 2f0aeec108
commit ea2c8d2d4d
6 changed files with 65 additions and 3 deletions

View File

@ -331,6 +331,8 @@ function prepareHeaders (headers = {}, auth) {
} else {
headers.authorization = `ApiKey ${auth.apiKey}`
}
} else if (auth.bearer) {
headers.authorization = `Bearer ${auth.bearer}`
} else if (auth.username && auth.password) {
headers.authorization = 'Basic ' + Buffer.from(`${auth.username}:${auth.password}`).toString('base64')
}