Session Conflict
When switching between user flows, Azure AD B2C may retain session information from the previous flow, leading to conflicts.
Solution: Clear Session or Use Prompt Parameter
Add the prompt=login
query parameter to the Vendor Sign-Up flow URL. This forces a new sign-in and ignores the previous session.
https://<tenant>.b2clogin.com/<tenant>.onmicrosoft.com/<sign-up-policy>/oauth2/v2.0/authorize?prompt=login
If the claims returned by the two flows are different (e.g., different required attributes or custom claims), the switch might fail.
Solution: Align Claims Between Flows
- Ensure both user flows are configured to handle overlapping claims.
- If your Vendor Sign-Up flow expects specific attributes, validate that these are handled properly in your application.
- Use custom policies if you need to define advanced claim transformations
- Token Scope or Audience Mismatch The application may fail to validate the token from the new flow if the scopes or audience (App ID URI) differ. Solution: Match App Registration
- Verify that both flows are linked to the same application registration in Azure AD.
- Ensure the API permissions (scopes) for the application registration allow access to the same resources.
- Check the
reply URLs
in the application registration to ensure they match the flow redirection URLs. - Missing or Incorrect Redirect URI If the redirect URI for the Vendor Sign-Up flow is not configured correctly in Azure AD, the flow will fail. Solution: Update Redirect URI
- In Azure Portal, go to Azure AD B2C > App registrations > Your App > Redirect URIs.
- Best Practices for Switching User Flows
Enable Single Sign-On (SSO):
- If appropriate, use SSO across flows to reduce authentication friction.
- Configure this in **Azure AD B2C > Identity Experience Framework > SSO Settings**.
**Use Custom Policies for Seamless Transitions:**
- Custom policies allow you to merge multiple flows or define behavior when transitioning between them.
- Example: Use a single custom policy to handle both sign-in and vendor registration dynamically.
Ensure Application Logic Handles State Changes:
- Your application should handle user state changes (e.g., from signed-in user to vendor) gracefully.