Add support for bearer auth (#1488)
This commit is contained in:
committed by
GitHub
parent
f2d8cf7d34
commit
101a13f63e
@ -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')
|
||||
}
|
||||
|
||||
5
lib/pool/index.d.ts
vendored
5
lib/pool/index.d.ts
vendored
@ -61,6 +61,10 @@ interface BasicAuth {
|
||||
password: string;
|
||||
}
|
||||
|
||||
interface BearerAuth {
|
||||
bearer: string
|
||||
}
|
||||
|
||||
interface resurrectOptions {
|
||||
now?: number;
|
||||
requestId: string;
|
||||
@ -204,6 +208,7 @@ export {
|
||||
getConnectionOptions,
|
||||
ApiKeyAuth,
|
||||
BasicAuth,
|
||||
BearerAuth,
|
||||
internals,
|
||||
resurrectOptions,
|
||||
ResurrectEvent,
|
||||
|
||||
Reference in New Issue
Block a user