question

MinaMounir-9860 avatar image
0 Votes"
MinaMounir-9860 asked bhasker412 answered

In Azure B2C Custom attributes is not passed with user claims

Hello,

I have created a signin/signup user flow in Azure B2C. I have created some custom attributes. when my custom Mobile application login, the token does not contain the custom attributes I created.
all my attributes are checked in the Application Claims.

azure-ad-b2c
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.

amanpreetsingh-msft avatar image
0 Votes"
amanpreetsingh-msft answered MinaMounir-9860 commented

@MinaMounir-9860 Did you select the attribute under User Attribute section as well? When you signed up for a user account, did you specify a value for the custom attribute? If the attribute doesn't have a value specified, it will not be returned in the token. In that case, you should consider using a profile update policy to update the value of that attribute first. Or sign-up with a new user account for testing purpose and make sure you specify a value for the attribute and check the token that you get after subsequent sign-in for that user.


Please "Accept as answer" wherever the information provided helps you to help others in the community.

· 2
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.

@MinaMounir-9860 Have you had a chance to test the above steps? If the issue is resolved please "Accept as answer" to help others in the community. If you have any further questions, please let me know.

0 Votes 0 ·

@amanpreetsingh-msft thank you for your reply, I checked all the user attributes as well.
I did not specify a value for this custom attribute. if this is the reason for not getting the attribute back in the token, is there is a way to set a default value for this attribute? so all the new users will have this value populated for them by default?

0 Votes 0 ·
amanpreetsingh-msft avatar image
0 Votes"
amanpreetsingh-msft answered

@MinaMounir-9860, You need to include this attribute in your Signup flow so that users can specify a value for this attribute when they sign-up. For existing users, you can include this attribute in the Profile Update policy, so that they can specify this attribute even after signup.
You can also login using your Global Admin account to https://developer.microsoft.com/en-us/graph/graph-explorer by clicking on Sign in with Microsoft button in the left pane and make below call to update the value of the extension attribute:

Call: PATCH https://graph.microsoft.com/beta/users/user's_object_id

Body: {"extension_2adxxxxxxxxxxxxxxxxxxxd1b5_ShoeSize": 11}

In this example, custom attribute is ShoeSize and the Value is 11.

5671-capture.jpg


Please "Accept as answer" wherever the information provided helps you to help others in the community.


capture.jpg (33.9 KiB)
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.

bhasker412 avatar image
0 Votes"
bhasker412 answered

@amanpreetsingh-msft

How to Add Custom attribute to user object while creating/updating using Microsoft.Graph SDK(Not with REST API)?

Every where i am finding sample with Graph REST API not with Graph SDK.

i am using as serviceClient.Users().Request.AddAsync(userObject) tried adding to additionaldata but it dint work out.


7963-exr4s7duyaaj4te.jpg


https://twitter.com/bhasker412/status/1257678665883648001?s=20



exr4s7duyaaj4te.jpg (123.0 KiB)
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.