Skip to content

Commit 4faaba4

Browse files
authored
Merge pull request #7937 from genlin/main-subservice
AB#2946 Infinite redirection between OpenID Connect app and Entra ID
2 parents 4de8fbf + 51b7e53 commit 4faaba4

2 files changed

Lines changed: 58 additions & 0 deletions

File tree

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
---
2+
title: Infinite redirection between OpenID Connect app and Entra ID
3+
description: Provides guidance for troubleshooting infinite redirection between the OpenID Connect app and Entra ID.
4+
ms.date: 12/26/2024
5+
ms.author: bachoang
6+
ms.service: entra-id
7+
ms.custom: sap:Microsoft Entra App Integration and Development
8+
---
9+
10+
# Troubleshoot infinite redirection between OIDC app and Entra ID
11+
12+
This article describes an infinite redirection issue that exists between an OpenID Connect (OIDC) application and Microsoft Entra ID.
13+
14+
## Symptoms
15+
16+
When you browse to a website that's built by using an OpenID Connect (OIDC) app and Microsoft Entra ID, the browser enters an infinite loop that forms between the website and the Microsoft Entra ID authentication process.
17+
18+
The issue specifically occurs when you browse the website by using the HTTP protocol. When you use HTTPS, the issue doesn't occur.
19+
20+
## Cause
21+
22+
The `.AspNet.Cookies` cookie isn't sent in HTTP requests because of its secure attribute.
23+
24+
## Solution: Enforce HTTPS navigation
25+
26+
To resolve the issue, enforce HTTPS navigation for the site. HTTPS is always recommended for sites that require authentication.
27+
28+
## Workaround
29+
30+
If your scenario requires the initial navigation to occur over HTTP, you can customize the Cookies Authentication middleware to allow the authentication AspNet cookie for both the HTTP and HTTPS schemes by setting the `CookieSecure` attribute to `CookieSecureOption.Never`, as shown in the following `Startup.Auth.cs` file.
31+
32+
> [!Note]
33+
> This workaround isn't recommended for production environments because it compromises security by allowing cookies to be sent over HTTP.
34+
35+
```csharp
36+
public void ConfigureAuth(IAppBuilder app)
37+
{
38+
app.SetDefaultSignInAsAuthenticationType(CookieAuthenticationDefaults.AuthenticationType);
39+
app.UseCookieAuthentication(new CookieAuthenticationOptions
40+
{
41+
CookieSecure = CookieSecureOption.Never
42+
});
43+
44+
app.UseOpenIdConnectAuthentication(
45+
new OpenIdConnectAuthenticationOptions
46+
{
47+
ClientId = clientId,
48+
Authority = authority,
49+
50+
}
51+
}
52+
```
53+
54+
This issue is discussed also in [this ASP.NET Security Blog article (Issue #219)](https://github.com/aspnet/Security/issues/219).
55+
56+
[!INCLUDE [Azure Help Support](../../../includes/azure-help-support.md)]

support/entra/entra-id/toc.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,8 @@
9494
href: app-integration/error-code-aadsts7000112-application-is-disabled.md
9595
- name: Troubleshoot signing in to SAML-based single sign-on configured apps
9696
href: app-integration/troubleshoot-sign-in-saml-based-apps.md
97+
- name: Troubleshooting infinite redirection between OIDC app and Entra ID
98+
href: app-integration/troubleshoot-oidc-http-infinite-redirection.md
9799
- name: User redirected to incorrect reply URL or localhost
98100
href: app-integration/reply-url-redirected-to-localhost.md
99101

0 commit comments

Comments
 (0)