I have a SignUp Invite Flow via email implemented using Azure Active Directory B2C Custom policy. It works as expected. But, I have a scenario to be handled.
If a user - UserA is signed into the application and has a valid session. The same user received a sign up link via email. Opens the email in the same browser on a different tab. Clicks on the SignUp invite link. Gets redirected to the SignUp page. Provides information as UserB. Successfully signs up. Gets redirected to the client app's redirect URI. Now since there exists a valid session for UserA already, the sign up link ends up authenticated into the application as UserB. Also, the user is not expected to click on the Logout button and multiple users are expected to share the same machine and hence the ask.
Although this sounds like a scenario less practical, it is a valid one for the client. I was looking for ways to achieve this.
What I am looking for are:
- A way to clear the session information once the user clicks on the SignUp button. Since it's a custom policy, the UI elements are not completely or partially under the client app's code's reach (IMO). Please correct me if I am wrong and if it's possible to take control over the click event and execute a piece of javascript code to clear the browser session for the user.
- A way to handle redirect for the SignUp flow separately such that the landing page only has code to execute 2 functions. ClearUserSession(); RedirectToLogin();
- Or any other way to handle this?
Basically a way to simulate a Sigout/Logout following a registration/signup.
I really appreciate any leads on this and will prove extremely helpful.