Skip to content

Conversation

@alex-dokienko
Copy link

To work with B2C, MSAL requires a different authority configuration. MSAL recognizes one authority URL format as B2C by itself. The recognized B2C authority format is https:///tfp//, for example https://login.microsoftonline.com/tfp/contoso.onmicrosoft.com/B2C_1_SignInPolicy. However, you can also use any other supported B2C authority URLs by declaring authority as B2C authority explicitly.

More info can be found here
https://learn.microsoft.com/en-us/entra/msal/objc/configure-authority

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi alex-dokienko,
this breaks support to authorities that do not have tfp in the url... it should be placed a check like you placed in other parts.
Moreover, one way to declare to MSAL that an authority is a B2C is to specify it in the configuration json like this:
{
"type": "B2C",
"authority_url": "https://contoso.b2clogin.com/contoso.onmicrosoft.com/PolicyName/",
"default": true
}

@alex-dokienko
Copy link
Author

@chipscal thanks for pointing for missing part, when I did integration for my project I managed to make it work for iOS only if I used tfp format in json file, so didn't test how this will work with original formats.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi alex-dokienko,

Let's say you almost solved the problem but there is still a problem in the "getAuthorityFromPolicyName" function.

I say to solve the problem you could add a private variable "bool isTFPFormat" to the B2CProvider that could be initialized during the "initMSAL" function... It should be sufficient to check if the authorityURL contains "/tfp/" like you done in other parts. Then modify the aforementioned function to return proper URL with or without "/tfp/" according to that variable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants