question

VikasTiwari-2263 avatar image
0 Votes"
VikasTiwari-2263 asked ManishPandit-9697 published

B2C technical profile for username and password

Hi,

I have created user through graph service client and setup following properties:

 SignInType = "userName",
  Issuer = tenantId,
  IssuerAssignedId = siteUser.userId

I am looking for example documentation to set technical profile as username and password instead of email address. So that when user will sign-in using credentials I can call rest api which will validate through legacy identity provider and give result back to B2C app (trying to achieve seamless user migration).

Thanks.

azure-ad-b2cazure-ad-graph
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

amanpreetsingh-msft avatar image
0 Votes"
amanpreetsingh-msft answered ManishPandit-9697 published

Hello @VikasTiwari-2263

For scenarios where you would like users to sign up and sign in with Usernames rather than Emails, you can use the sample below:

https://github.com/azure-ad-b2c/samples/tree/master/policies/username-signup-or-signin/policy

You need to chain the Username_TrustFrameworkExtensions.xml file with your existing TrustFrameworkBase and TrustFrameworkExtensions file, which will look like:

SignupOrSignIn > Username_TrustFrameworkExtensions > TrustFrameworkExtensions > TrustFrameworkBase.

For this purpose, base policy tag in Username_TrustFrameworkExtensions.xml file should be:

 <BasePolicy>
     <TenantId>yourtenant.onmicrosoft.com</TenantId>
     <PolicyId>B2C_1A_TrustFrameworkExtensions</PolicyId>
 </BasePolicy>

And in the SignupOrSignIn.xml file, it should be:

 <BasePolicy>
     <TenantId>yourtenant.onmicrosoft.com</TenantId>
     <PolicyId>B2C_1A_Username_TrustFrameworkExtensions</PolicyId>
 </BasePolicy>

Please "Accept the answer" if the information helped you. This will help us and others in the community as well.


· 4
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Thanks @amanpreetsingh-msft that was helpful, could you please also guide me any documentation to call rest api and pass custom header?

In my case we have to call rest api to validate user credentials but also to pass following header value (to authenticate api calls):
x-api-key : "api key value"

I have tried to search around and looks like this feature was voted sometime ago, do you if its possible to send custom header through custom policy?

Thanks.

0 Votes 0 ·

Hi @VikasTiwari-2263 This functionality is recently added. Not sure if it is documented yet. Could you please post a separate question regarding this and tag me in? I will try to find documentation and if the documentation is not yet updated, I will share the parameters to pass the header.

1 Vote 1 ·

Hi @amanpreetsingh-msft,

as you have suggested I have post different question here, could you please take a look before I accept answer and close it?

Thanks for you help.


0 Votes 0 ·

Hi


In the above Github repository B2C_1A_TrustFrameworkExtensions.xml file is missing.

Which B2C_1A_TrustFrameworkExtensions.xml file we should use to singup/sgnin with UserName?

Also TrustFrameworkBase and Localization files are mandatory. Then please help us with those files also.

Thanks
Manish Pandit

0 Votes 0 ·