简体   繁体   中英

Azure AD B2C, get MFA verified phone number programmatically

When I create a user in my web app using a B2C policy, and use a number for MFA, that number gets stored under "Authentication Contact Info" in the portal. It does not get stored in the claim from what I can see.

How can I access this number programmatically? If I wanted to access for example the users surname I'd use:

var identity = (ClaimsPrincipal)Thread.CurrentPrincipal;
var name = identity.Claims.Where(c => c.Type == ClaimTypes.Surname).Select(c => c.Value).SingleOrDefault();

Is there any way, like above or any other way like for example using Graph API, to access the stored phone number used during MFA?

As far as I know, it is not possible to retrieve the phone number for the MFA. We can only get the telephoneNumber(The primary telephone number of the user's place of business.) through the Azure AD Graph API( refer here ).

If you want the Azure AD Graph also support for the phone number(Authentication Contact Info) of for the MFA, you can submit the feedback from here .

It's possible to retrieve the phone number for the MFA through Microsoft's provisioning API published here .

If you generate the code through svcutil.exe you will have to manually inject the soap authentication and version headers though. You can then use the GetUser or ListUser service call to actually retrieve the phone number of a specific user from your Azure AD B2C.

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