diff --git a/packages/desktop-app/src/app/services/app-verification-window.service.ts b/packages/desktop-app/src/app/services/app-verification-window.service.ts index dd45a8dc8..88949a511 100644 --- a/packages/desktop-app/src/app/services/app-verification-window.service.ts +++ b/packages/desktop-app/src/app/services/app-verification-window.service.ts @@ -8,10 +8,11 @@ import { import { IAwsSsoOidcVerificationWindowService } from "@noovolari/leapp-core/interfaces/i-aws-sso-oidc-verification-window-service"; import { WindowService } from "./window.service"; import { MessageToasterService, ToastLevel } from "./message-toaster.service"; +import { AwsCoreService } from "@noovolari/leapp-core/services/aws-core-service"; @Injectable({ providedIn: "root" }) export class AppVerificationWindowService implements IAwsSsoOidcVerificationWindowService { - constructor(private windowService: WindowService, private toasterService: MessageToasterService) {} + constructor(private windowService: WindowService, private toasterService: MessageToasterService, private awsCoreService: AwsCoreService) {} async openVerificationWindow( registerClientResponse: RegisterClientResponse, @@ -62,7 +63,7 @@ export class AppVerificationWindowService implements IAwsSsoOidcVerificationWind // When the code is verified and the user has been logged in, the window can be closed verificationWindow.webContents.session.webRequest.onCompleted( { - urls: ["https://oidc.eu-west-1.amazonaws.com/device_authorization/associate_token"], + urls: this.getAssociateTokenUrls(), }, (details, callback) => { if (details.method === "POST" && details.statusCode === 200) { @@ -99,6 +100,10 @@ export class AppVerificationWindowService implements IAwsSsoOidcVerificationWind }); } + private getAssociateTokenUrls() { + return this.awsCoreService.getRegions().map((region) => `https://oidc.${region.region}.amazonaws.com/device_authorization/associate_token`); + } + private async openExternalVerificationBrowserWindow( registerClientResponse: RegisterClientResponse, startDeviceAuthorizationResponse: StartDeviceAuthorizationResponse