Home

Asp.net MVC azure AD authentication infinite loop

%3CLINGO-SUB%20id%3D%22lingo-sub-210639%22%20slang%3D%22en-US%22%3EAsp.net%20MVC%20azure%20AD%20authentication%20infinite%20loop%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-210639%22%20slang%3D%22en-US%22%3E%3CP%3EWe%3CSPAN%3E%20have%20an%20asp.net%20mvc%20application%20with%20AAD%20sign%20in%20where%20we%20have%20OWIN%20configured%20to%20use%20OpenID%20Connect.%20When%20I%20launch%20the%20application%20it%20goes%20to%20the%26nbsp%3Bazure%20to%20authenticate%20in%20AD%2C%20then%20it%20goes%20back%20to%20the%20application%20to%20the%20controller%2C%20and%20its%20redirected%20back%20again%20to%20azure.%20But%20not%20all%20the%20time%20%2C%20sometimes%20it%20goes%20into%20an%20infinite%20loop%20sometime%20it%20Authenticates%20without%20any%20issue%20and%20displays%20the%20landing%20page.%20%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%3EAny%20inputs%20will%20help.%26nbsp%3B%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-210639%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EAzure%20AD%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-210841%22%20slang%3D%22en-US%22%3ERe%3A%20Asp.net%20MVC%20azure%20AD%20authentication%20infinite%20loop%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-210841%22%20slang%3D%22en-US%22%3E%3CP%3EHello%20Venkatesh%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20would%20recommend%20to%20take%20a%20fiddler%20trace%20for%20both%20the%20working%20and%20non-working%20scenario.%3C%2FP%3E%3CP%3EAlso%20validate%20the%20token%20that%20you%20are%20getting%20from%20Azure%20AD%20in%20both%20the%20working%20and%20non-working%20scenario.%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIf%20the%20token%20that%20you%20are%20getting%20is%20same%20in%20both%20the%20scenarios%20that%20issue%20is%20with%20the%20authentication%20handler%20configuration%20on%20the%20application%20side.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIf%20you%20are%20getting%20different%20set%20of%20claim%20(which%20is%20likely%20be%20the%20least%20probability)%20%2C%20then%20check%20the%20first%20authentication%20request%20sent%20to%20azure%20AD%20for%20non%20working%20scenario.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ERegards%2C%3C%2FP%3E%3CP%3ERishabh%3C%2FP%3E%3C%2FLINGO-BODY%3E
Highlighted
Venkatesh Kagalvadi
Microsoft

We have an asp.net mvc application with AAD sign in where we have OWIN configured to use OpenID Connect. When I launch the application it goes to the azure to authenticate in AD, then it goes back to the application to the controller, and its redirected back again to azure. But not all the time , sometimes it goes into an infinite loop sometime it Authenticates without any issue and displays the landing page.

Any inputs will help. 

1 Reply

Hello Venkatesh,

 

I would recommend to take a fiddler trace for both the working and non-working scenario.

Also validate the token that you are getting from Azure AD in both the working and non-working scenario. 

 

If the token that you are getting is same in both the scenarios that issue is with the authentication handler configuration on the application side.

 

If you are getting different set of claim (which is likely be the least probability) , then check the first authentication request sent to azure AD for non working scenario.

 

Regards,

Rishabh

Related Conversations
Tabs and Dark Mode
cjc2112 in Discussions on
46 Replies
Extentions Synchronization
Deleted in Discussions on
3 Replies
Stable version of Edge insider browser
HotCakeX in Discussions on
35 Replies
How to Prevent Teams from Auto-Launch
chenrylee in Microsoft Teams on
30 Replies
flashing a white screen while open new tab
Deleted in Discussions on
14 Replies
Security Community Webinars
Valon_Kolica in Security, Privacy & Compliance on
13 Replies