How to get object ID value from Azure AD B2C user profile edit process

Viewed 222

I am developing an Azure AD B2C custom policy. Due to some requirements,I need to get the value of user object ID on edit profile process to call some third-party APIs. However, I can't letting this value show up on edit profile,even though I have added object id as a member of OutputClaims in AAD-UserReadUsingEmailAddress in Base.xml. So my question is if it possible that show a user's object id value on edit profile page? If not, is there any workaround for this requirement?

Thanks in advance.

1 Answers

Edit Profile page only displays user editable attributes. Object ID is a attribute that user can't edit, so it can't be displayed on this page even though you have added it in OutputClaims . So if you just want to get its value on Profile Edit Page, you could define a custom attribute to copy this value and display this custom attribute on Profile Edit page. If you would like to do so, there would be 2 steps:

  1. Add a step for new user register process: copy user's object value to a custom attribute.
  2. For exist users, you should run some scripts to copy user's object value to a custom attribute.
Related