Base solution for your next web application
Open Closed

MSAL.NET redirect loop when using azure ad for authentication and authorization #11857


User avatar
0
huntethan89 created

Hello team,

Our base URL is set to 'http://localhost:6240', and I have encountered a problem when attempting to access URLs beyond the base, such as 'http://localhost:6240/Mpa/Timesheet'. The issue manifests as an infinite loop, preventing successful navigation to the desired URLs.

To provide more context, our authentication and authorization are implemented using Azure AD OpenID Connect. I have reviewed our configuration settings and code, but the problem persists.

I have attached an image of the issue that I am encountering every time while trying to login

Could you kindly assist in troubleshooting this issue or guide me on potential areas to investigate further? Any insights or suggestions would be greatly appreciated.

Error1.png


5 Answer(s)
  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @huntethan89

    Are there any related messages in the log file which you can find under App_Data/Logs folder ?

    Thanks,

  • User Avatar
    0
    huntethan89 created

    Hi @ismcagdas No, This is the only error we can able to see.

    Thanks,

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    Could you check https://github.com/aspnetzero/documents/blob/8c836503b46f611bf1c74df98edb65fa38f6aaee/blog-posts/en/integrating-azure-active-directory-with-asp.net-zero.md and see if it helps ? If you can't solve the problem, can you provide us access to your source code privately ?

    Thanks,

  • User Avatar
    0
    huntethan89 created

    Hi @ismcagda, Thank you for providing the solution, But I have noticed that, when I am using base URL so for authentication its going on LogIn method inside my application after that microsoft logIn page is opening, but when I am using any relative URL other than base URL, it's not going on Login method for authentication, by default its opening microsoft login page. So how we can configure that, every URL will go on LogIn method inside my application first if not authenticated.

    Any insights or suggestions would be greatly appreciated.

    Thanks,

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @huntethan89

    By default, any unauthenticated user must be redirected to Login page. We need to see your source code to identify this issue. Is it possible to share your project privately with us ?