Azure ad redirect loops in S3 bucket. Works fine in local

153 Views Asked by At

I am using angular 7 application. https://github.com/AzureAD/microsoft-authentication-library-for-js/tree/dev/samples/msal-angular-samples/angular7-sample-app

I used this sample application too. I commented if clause in the login function in app.component.ts so that it only redirects for login.

login() {
  //  const isIE = window.navigator.userAgent.indexOf('MSIE ') > -1 || window.navigator.userAgent.indexOf('Trident/') > -1;

   // if (isIE) {
      this.authService.loginRedirect();
   // } else {
     // this.authService.loginPopup();
    }
  }

I built this application and deployed it in the S3 bucket.

Now, on clicking login button, It redirects me to AZURE AD. Once I have entered password, It redirects me to my domain url domain.com/index.html#id_token=eyjsjsns.... then it continues loops their. I can't able to login. Please help me here. Thanks in advance.

Angular 7 with azure ad login redirects hosted in S3 bucket loops on the Idtoken.

1

There are 1 best solutions below

0
siva sankar On BEST ANSWER

I moved the angular7 application from s3 bucket to ECS container. It works fine now. I used ALB redirection rules to get index.html in the s3 bucket which reflects in the route as well(https://example.com/index.html). Now, in the container I have the normal route(https://example.com) and it works fine.