How to Return Custom Policy in Access Token Without "extension_" Prefix Using Azure B2C

Anonymous
2024-02-19T10:25:03.41+00:00

I'm currently implementing a custom policy in Azure AD B2C and facing an issue where the custom attributes in the access token are prefixed with "extension_". I aim to include custom claims in the access token without this prefix. While I have explored the Azure B2C starter pack, I'm encountering difficulties in manipulating the XML files to achieve this outcome. Could someone provide a step-by-step guide or direct me to comprehensive resources on how to:

  1. Modify the standard or custom policies in Azure B2C to include custom claims in the access token without the "extension_" prefix.
  2. Specifically, which XML files in the B2C starter pack need adjustments, and what specific changes are required to remove the prefix from custom attributes in the token.

Any examples or links to detailed documentation on this process would be immensely helpful. Thank you!

Microsoft Security Microsoft Entra Microsoft Entra ID
Microsoft Security Microsoft Graph
{count} votes

1 answer

Sort by: Most helpful
  1. Shweta Mathur 30,296 Reputation points Microsoft Employee Moderator
    2024-02-20T09:04:27.68+00:00

    Hi @Rakshit Shinde (XORIANT CORPORATION) , Thanks for reaching out. In your RelyingParty definition, you can specify a PartnerClaimType which is the name B2C will use for a claim in the token. For example, the RelyingParty definition:

    <RelyingParty>
    

    Would generate a token with "sampledata" claim in addition to other claims. Option 2 - ClaimType definition Alternatively, you can specify the same thing in the ClaimType definition itself:

    <ClaimType Id="extension_sampledata">
    

    That then automatically applies the appropriate PartnerClaimType, depending on the protocol. Hope this will help.

    Thanks,

    Shweta


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

    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.