Azure AD B2C custom claims not returned in token

Fredrik Svensson 21 Reputation points
2022-12-01T08:07:59.423+00:00

we are setting up an Azure AD B2C for our IoT Plattform where we have some custom claims.
We have a manual to setup the AADB2C and this has worked previously returning the custom claim.

But when i created a new instance this week it doesn't return the custom claim.
We setup a user flow with the following claims
266000-image.png
the id_token looks like this
266061-image.png

Has something changed the last months?

Microsoft Security | Microsoft Entra | Microsoft Entra External ID
0 comments No comments
{count} votes

Accepted answer
  1. Shweta Mathur 30,296 Reputation points Microsoft Employee Moderator
    2022-12-02T07:26:46.013+00:00

    Hi @Fredrik Svensson ,

    Thanks for reaching out.

    In order to get these claims, you need to navigate to your User Flow and select below:

    User attributes: isAdmin(custom) along with other claims

    266420-image.png

    Application claims: isAdmin(custom) along with other claims you wish to see it in the token sent back to your application.

    266464-image.png

    Once we signed-up with a new user account and provided values to these attributes, only then we were able to get the claims in the token. The attributes with no value are not returned in the token.

    266551-image.png

    Hope this will help.

    Thanks,
    Shweta

    ----------------------------

    Please remember to "Accept Answer" if answer helped you.

    1 person found this answer helpful.

2 additional answers

Sort by: Most helpful
  1. Fredrik Svensson 21 Reputation points
    2022-12-02T12:01:08.897+00:00

    @SwathiDhanwada-MSFT thanks for the clarification. we are currently investigating on our side.
    It might be that we have manually set the IsAdmin flag previously on the first user and therefore never
    seen the problem with the claim not returning.

    when we are creating users in the ui we always set the IsAdmin to true/false

    thanks for the info it helped us investigating and i will revert and accept the answer if we see that it fits

    0 comments No comments

  2. Fredrik Svensson 21 Reputation points
    2022-12-02T12:27:20.49+00:00

    we have now verified that it works! thank you for your support @SwathiDhanwada-MSFT

    i think the documentation really should clearly state that the custom claims need to be defined for them to be returned. seems to be some confusion and not just from me :)

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.