Azure AD B2C session behavior

Binh Tu 0 Reputation points
2024-07-31T07:59:02.7033333+00:00

Hi there,

Currently I have issue with Logout when using Azure AD B2C for my React app. Issue described below:

I have create 2 different user flows on my Azure AD B2C tenant as below:
B2C_1_Tenant_SI: single sign-on configuration of this policy is set as Tenant

User's image

B2C_1_Application_SI: single sign-on configuration of this policy is set as Application

User's image

And I use the sample React app which provide by microsoft to do testing for 2 scenarios:

Scenario 1: configure React app to use B2C_1_Tenant_SI.

  1. lauch the react app, click on sign in using either popup or redirect, let's use popup.

User's image

  1. it popup the login page, then I key in my credentials and after authenticated it close popup and back to my react app and show the ID token info.
  2. click on sign out, and sign out successfully. User's image
  3. click on sign in using popup again, it popup the login page to ask for my credentials. This is expectation because i clicked sign out, and it cleared Azure B2C user's session.

Scenario 2: configure React app to use B2C_1_Application_SI.

  1. lauch the react app, click on sign in using either popup or redirect, let's use popup.
  2. it popup the login page, then I key in my credentials and after authenticated it close popup and back to my react app and show the ID token info.
  3. click on sign out, and sign out successfully.
  4. click on sign in using popup again, it popup the window and close immediately to back to my react app and show the ID token info without asking me to key in my credential. <---- This is unexpectation, it should ask for my credentials because I have signed out successfully at step 3 but seems like the Azure B2C user's session was not cleared.

Can anyone help to explain the issue above?

Here is code of handling logoutUser's image

Thanks a lot.

Microsoft Entra ID
Microsoft Entra ID
A Microsoft Entra identity service that provides identity management and access control capabilities. Replaces Azure Active Directory.
25,075 questions
{count} votes

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.