Last post May 19, 2021 01:28 PM by mgebhard
May 19, 2021 08:20 AM|Arby360|LINK
I have no issues with chrome. It is the edge browser where I am facing issues. I have tried to clear the cache. Deleted cookies. Reset the browser. Nothing worked. I keep getting infinite loop on login. And it eventually fails with message **"We couldn't
sign you in. Please try again."** . Any help is appreciated.
public void ConfigureServices(IServiceCollection services)
builder => builder.AllowAnyOrigin()
services.Configure<OpenIdConnectOptions>(OpenIdConnectDefaults.AuthenticationScheme, options =>
options.Events.OnRedirectToIdentityProviderForSignOut = async context =>
var azureAd = new AzureAd();
.AddAzureAD(options => Configuration.Bind("AzureAd", options));
var url = "https://abcd.xyz.com/platform/signin-oidc";
//var url = "https://localhost:5001/platform/signin-oidc";
services.Configure<OpenIdConnectOptions>(AzureADDefaults.OpenIdScheme, options =>
options.SaveTokens = true;
options.Events = new OpenIdConnectEvents
OnRedirectToIdentityProvider = async context =>
context.ProtocolMessage.RedirectUri = url;
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
// The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
I have also tried
Nothing seems to work.
BTW it only happens after deployment. Never on localhost.
The following is screenshot of network tab:
May 19, 2021 01:28 PM|mgebhard|LINK
I'm surprised only Edge has this issue. As far as I can tell the configuration sets the redirect URL to the remote authentication server in OnRedirectToIdentityProvider??? This configuration should cause the infinite redirect loop you've reported. The
redirect URL is always an address on the UI site not the remote host. Typically the URL is set by the client UI application configuration so the user is redirected back to the URL they were trying to access before being authenticated.
Can you explain the design intent?
Lastly, AzureADDefaults is obsolete in .NET 5. You'll want to update the configuration to use the Microsoft.Identity.Web.