Skip to content

Commit

Permalink
fix authorizeProfile with Keys
Browse files Browse the repository at this point in the history
  • Loading branch information
pavelefros committed Jul 3, 2024
1 parent b27d44f commit e668958
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/services/profile.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,15 +136,17 @@ export class ProfileService {
switch (profile.type) {
case ProfileType.KEY:
const url = profile.team.replace(/\/?$/, "/api/cloud/team");
this.tryKeyAuthentication(url, AuthenticationType.BEARER, profile.apiToken).then(() => {
try {
await this.tryKeyAuthentication(url, AuthenticationType.BEARER, profile.apiToken);
profile.authenticationType = AuthenticationType.BEARER;
}).catch(() => {
this.tryKeyAuthentication(url, AuthenticationType.APPKEY, profile.apiToken).then(() => {
} catch (e) {
try {
await this.tryKeyAuthentication(url, AuthenticationType.APPKEY, profile.apiToken);
profile.authenticationType = AuthenticationType.APPKEY;
}).catch(() => {
} catch (err) {
logger.error(new FatalError("The provided team or api key is wrong."));
})
});
}
}
break;
case ProfileType.DEVICE_CODE:
try {
Expand Down

0 comments on commit e668958

Please sign in to comment.