How to redirect microsoft login to the right reply url

Zheng, Huili 0 Reputation points
2025-02-18T21:47:21.35+00:00

Hi, I have confirmed that the reply url of the my web app registered at AAD is 'https//my-web-app.azurewebsites.net/auth/callback' and the env variables i set is the same value, too.
But when i logged in, the page got 302.Screenshot 2025-02-18 at 3.47.43 PM

Azure Static Web Apps
Azure Static Web Apps
An Azure service that provides streamlined full-stack web app development.
1,177 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Bhargavi Naragani 5,575 Reputation points Microsoft External Staff Moderator
    2025-03-06T21:24:00.5533333+00:00

    Hi @Zheng, Huili,

    Microsoft’s identity platform requires that the reply URL registered in Azure AD match exactly with what’s provided in your application’s configuration, so even a small formatting error can disrupt the login process. In your case, the URL is registered as “https//my-web-app.azurewebsites.net/auth/callback” which is missing the colon after “https”; it should be “https://my-web-app.azurewebsites.net/auth/callback”.

    This precise URL must be consistently configured in both your Azure AD app registration and your application’s environment variables, as any discrepancy in protocol, path, or even a trailing slash can cause the platform to reject the redirection. While a 302-status code is a normal part of the authentication flow, it signals that the redirection target isn’t correctly recognized when there’s a formatting error. 

    If the answer is helpful, please click Accept Answer and kindly upvote it so that other people who faces similar issue may get benefitted from it.

    Let me know if you have any further Queries.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.