Bitbucket Cloud - API Token Support

Signed-off-by: Andre Wanlin <awanlin@spotify.com>
This commit is contained in:
Andre Wanlin
2025-11-17 12:49:43 -06:00
parent dd54fffedc
commit fa255f530a
12 changed files with 223 additions and 84 deletions
@@ -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;