简体   繁体   中英

Xamarin Forms: Azure AD B2C using MSAL: Set Client Id through code

I am trying to use MSAL for Azure AD B2C authentication in Xamarin forms. I have followed this tutorial: Tutorial

But this asks to set the client id in Intent Filter. What if i am building a product and it needs to be distributed to more then one customer through public store?

Is there any way we can set the client ID programmatically? Please help. Thank you.

You should not set client ID programmatically.

If you want your customer from different tenants to use your B2C project, you just need to configure your Azure AD app as multi-tenant.

Just like the document you shared mentions:

Select Accounts in any organizational directory or any identity provider.

And then you could Set up sign-in for multi-tenant Azure Active Directory using custom policies in Azure Active Directory B2C . Then customer will be able to log into your project with their own credentials.

In fact , you don't even need to configure sign-in for multi-tenant Azure Active Directory using custom policies. Customers could sign up to your B2C tenant to use your product. This is exactly how B2C works.

The client id used in the IntentFilter on that particular tutorial is for the DataScheme which needs to be unique, so AAD knows where to redirect after the authentication screen. You could use a different value if you want. It is common to use the reverse-DNS for that field (as for the app package).

In other words, clientId is not mandatory for that field.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM