0

I'm currently having an unusual issue with azure b2c user flows.

The scenario of the issue:

I have many users and sometimes (not all of them) they get stuck in a loop when they try to log in. They have to perform successfully log-in in 2 or 3 times in a row just to finally get access to the application.

So far I couldn't find any solution or any reason for this behavior. Is this a common trouble using azure b2c or it could be something related to the network?

Any advice or clue would be great!

1 Answers1

0

First you need to confirm where the 'loop' is happening. It's either happening:

  1. Within Azure AD B2C policy
  2. Between App and Azure AD B2C

Determine this by using Fiddler or logs (application logs and Azure AD B2C logs)

If Within Azure AD B2C policy, there's something misconfigured within your policy

If Between App and Azure AD B2C, either your application is not parsing the token correctly - this could be MSAL not setup correctly, it's thinking the token isn't valid or it's expired, or even missing some claim. To fix this, look at the application logs first to see if it states why it's having to automatically make a new request.

Network related is always a factor to consider - especially if you have a WAF. Again, always check your logs before trying to change anything. Additionally, always test with multiple browsers (if this is a web app) since browsers can be bad actors when testing - especially with session management.

Chad Hasbrook
  • 206
  • 1
  • 6
  • currently, I'm using az b2c built-in userflow so I think the configuration is quite limited for this(sorry if maybe I'm talking nonsense). In this case, I've checked the logs and I'm seeing that after I got the token I'm being redirected to azure b2c userflow again so there's probably something there. – Yair Ruiz barbas Aug 26 '22 at 19:41
  • If you are getting a token and it hits the application, setup a code break and walkthrough how MSAL is responding to the token. The application apparently doesn't like the token you provided or isn't accepting it. Best method is to step through your code and see if an exception or error is being thrown silently. Confirm timestamps are correct. – Chad Hasbrook Aug 30 '22 at 22:58