How to add Custom Claim in sharepoint online web client extensibility app

Irfan Shaikh 20 Reputation points
2025-12-03T16:49:48.9466667+00:00

Hi,

We have deployed a chatbot on sharepoint using the spfx package. We need to pass a custom claim in the token so we can capture the users location. But right now sharepoint online web client extensibility app is getting the token with fixed claims such as first name last name email etc.

Is there anyway to pass a custom claim. If not how can I accomplish this.

Thanks

Developer technologies | .NET | Other
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Q&A Assist
    2025-12-03T16:49:59.9066667+00:00
    AI generated content. This question contains an answer created with AI from Q&A Assist. Learn more

    To add a custom claim in a SharePoint Online web client extensibility app, you can utilize the Microsoft Entra ID features for customizing claims in the tokens. Here are the general steps you can follow:

    1. Sign in to the Microsoft Entra admin center: Go to the Entra admin center and sign in with your admin account.
    2. Navigate to App registrations: Browse to Entra ID > App registrations and select your application from the list.
    3. Manage Attributes & Claims: Under the Manage section, select Single Sign-on and then go to the Attributes & Claims section.
    4. Add a Custom Claim:
      • Select Add new claim.
      • Enter a Name for your custom claim.
      • Choose Directory schema extension as the source.
      • Select the appropriate application that contains your extension attributes (e.g., b2c-extensions-app) and choose the custom attribute you want to add.
      • Save your changes.
    5. Update the Application Manifest: Ensure that the application manifest is updated to accept mapped claims by setting the acceptMappedClaims key to true.

    By following these steps, you should be able to pass a custom claim in the token, which can then be used to capture the user's location or any other required information.


    References:

    0 comments No comments

Your answer

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