Managing external identities to enable secure access for partners, customers, and other non-employees
Our application's Azure login page intermittently encounters a 400 error, and even when a 200 response is received, the login process sometimes fails unexpectedly.
Typically, the Azure AD B2C login flow using MSAL React redirects to https://tenantname.b2clogin.com/tenantname.onmicrosoft.com/policyname/oauth2/v2.0/authorize. However, in certain cases, after submitting the login form, it redirects to https://tenantname.b2clogin.com/tenantname.onmicrosoft.com/policyname/api/CombinedSigninAndSignup/confirmed instead of the redirect_uri specified in the MSAL configuration.
For additional details, please refer to the screenshots in the following link: Google Drive Link to Screenshots
The screenshots include the MSAL React configuration, custom policy configurations, and login page API responses.
Similar issues have been reported in https://github.com/AzureAD/microsoft-authentication-library-for-js/issues/4718
This issue seems more likely to occur when the application's Azure login page remains idle for around 3 hours before attempting to log in. On a second attempt, the login generally succeeds without issues.
We would appreciate your assistance in identifying the root cause and resolving the issue.