Issue in adding custom claims via policy in client credentials flow

Shekhar Nadide 201 Reputation points
2025-04-30T14:50:20.9766667+00:00

I am using the below reference and trying to add custom claims but it was not working. Could you please help me resolve this issue.

Ref Links :

https://learn.microsoft.com/en-us/azure/active-directory-b2c/client-credentials-grant-flow?pivots=b2c-custom-policy#step-4-customize-the-token

https://github.com/azure-ad-b2c/samples/tree/master/policies/client_credentials_flow

if possible could you please provide me correct custom policy xml file

Error :

{
    "error": "invalid_grant",
    "error_description": "AADB2C90085: The service has encountered an internal error. Please reauthenticate and try again.\r\nCorrelation ID: 21e73d28-4e06-4c81-959a-00af1c5c078e\r\nTimestamp: 2025-04-30 14:47:41Z\r\n"
}

User's image

Thanks in advance!

Microsoft Entra External ID
Microsoft Entra External ID
A modern identity solution for securing access to customer, citizen and partner-facing apps and services. It is the converged platform of Azure AD External Identities B2B and B2C. Replaces Azure Active Directory External Identities.
3,156 questions
{count} votes

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.