Skip to content

Commit

Permalink
fix: auth with apppassword
Browse files Browse the repository at this point in the history
  • Loading branch information
adelkahomolova committed Oct 10, 2019
1 parent 6d48b50 commit 1e3c80c
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions src/services/bitbucket/BitbucketService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,19 +26,18 @@ export class BitbucketService {
constructor(@inject(Types.ArgumentsProvider) argumentsProvider: ArgumentsProvider) {
this.cache = new InMemoryCache();

// const clientOptions = {
// baseUrl: 'https://api.bitbucket.org/2.0',
// headers: {},
// options: {
// timeout: 10,
// },
// };
const clientOptions: Bitbucket.Options = {
hideNotice: true,
};

this.client = new Bitbucket(clientOptions);

this.client = new Bitbucket();
const uri = argumentsProvider.uri.split('/');
const username = uri[uri.length - 2];

let auth: Bitbucket.Auth;
if (argumentsProvider.auth) {
auth = { type: 'token', token: argumentsProvider.auth };
auth = { type: 'apppassword', username: username, password: argumentsProvider.auth };
this.client.authenticate(auth);
}
}
Expand Down

0 comments on commit 1e3c80c

Please sign in to comment.