question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Using multiple B2C sign in policies

See original GitHub issue

Core Library

MSAL.js v2 (@azure/msal-browser)

Core Library Version

2.28.1

Wrapper Library

MSAL Angular (@azure/msal-angular)

Wrapper Library Version

2.4.1

Public or Confidential Client?

Public

Description

We are looking at implementing a impersonation flow to our Angular application. Currently we are using a custom sign-in sign-up policy using local accounts.

The requirements are to be able to login via Azure AD (single tenant) then impersonate a local account. We’ve setup login via AzureAD and that works. We have also setup the impersonation flow (in a separate policy) which has the user login via AzureAD then does the impersonation flow. If I set the authority to https://{Url}/{TenantID}/B2C_1A_IMPERSONATION then I can impersonate users.

Knowing both flows work on their own we want to be able to have the site allow users from either sign in type.

So far we have tried setting the knownAuthorities to have both B2C_1A_IMPERSONATION and B2C_1A_SIGNUP_SIGNIN. This causes no login actions to be tried as it doesn’t know where to get the well-known config from (this is an assumption).

Any help on getting this working or a simple this isn’t possible would be great.

MSAL Configuration

{
   "auth":{
      "clientId":"{clientId}",
      "authority":"https://{url}/B2C_1A_IMPERSONATION",
      "knownAuthorities":[
         "{domain}"
      ],
      "redirectUri":"http://localhost:4200",
      "postLogoutRedirectUri":"{logoutUri}"
   },
   "cache":{
      "cacheLocation":"BrowserCacheLocation.LocalStorage",
      "storeAuthStateInCookie":isIE
   }
}

Relevant Code Snippets

No response

Identity Provider

Azure B2C Custom Policy

Source

External (Customer)

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
jasonnuttercommented, Sep 21, 2022

@blockingHD You can set the authority for a given request on a per-request basis, which would enable you to login with a different B2C policy than the one set in the configuration (auth.authority above). Have you tried this? If so, can you provide code snippets show what you tried and what happens when do?

0reactions
msftbot[bot]commented, Oct 3, 2022

This issue requires attention from the MSAL.js team and has not seen activity in 5 days. @hectormmg please follow up.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Can we have two sets of Azure B2C sign-in custom policies ...
Based on my understanding, I will have to create two different custom policy for user type 1 & 2? Is that right?
Read more >
ASP.NET Core App with Multiple Sign-In Policies in Azure ...
Sometimes you may want to use multiple sign-in policies in Azure AD B2C with a single ASP.NET Core application. This article shows you...
Read more >
Using multiple Azure B2C user flows from ASP.NET Core
This article shows how to use multiple Azure B2C user flows from a single ASP.NET Core application. Microsoft.Identity.
Read more >
How to configure multiple B2C policies with Microsoft. ...
I want my application to accept signins from two different B2C user flows, using the same tenant and app registration.
Read more >
Is it possible to configure more than one Azure B2C Policy
How to swap policies in B2C tenant for MFA? The out-of-the-box OpenID Connect Provider only supports one Azure AD B2C policy/user flow, is...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found