Bitbucket Cloud - API Token Support
Signed-off-by: Andre Wanlin <awanlin@spotify.com>
This commit is contained in:
@@ -155,14 +155,17 @@ export class BitbucketCloudClient {
|
||||
private getAuthHeaders(): Record<string, string> {
|
||||
const headers: Record<string, string> = {};
|
||||
|
||||
if (this.config.username) {
|
||||
if (
|
||||
this.config.username &&
|
||||
(this.config.token ?? this.config.appPassword)
|
||||
) {
|
||||
const buffer = Buffer.from(
|
||||
`${this.config.username}:${this.config.appPassword}`,
|
||||
`${this.config.username}:${
|
||||
this.config.token ?? this.config.appPassword
|
||||
}`,
|
||||
'utf8',
|
||||
);
|
||||
headers.Authorization = `Basic ${buffer.toString('base64')}`;
|
||||
} else if (this.config.token) {
|
||||
headers.Authorization = `Bearer ${this.config.token}`;
|
||||
}
|
||||
|
||||
return headers;
|
||||
|
||||
Reference in New Issue
Block a user