Grant type client_credentials not working for b2c app registration with "signInAudience": "AzureADMyOrg"

Jef Schraag-Halma 21 Reputation points
2024-01-18T16:37:56.47+00:00

I can't get tokens via grant_type=client_credentials if the app registration manifest contains "signInAudience": "AzureADMyOrg".

With AzureADMyOrg I get this error:

{
    "error": "invalid_grant",
    "error_description": "AADB2C90085: The service has encountered an internal error. Please reauthenticate and try again.\r\nCorrelation ID: ... \r\nTimestamp: ...\r\n"
}

After updating signInAudience to AzureADandPersonalMicrosoftAccount (and waiting for about 20 minutes), my token requests succeed.

Is it a bug in the B2C client credentials flow that "signInAudience": "AzureADMyOrg" is not working?

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

Accepted answer
  1. Shweta Mathur 30,296 Reputation points Microsoft Employee Moderator
    2024-01-19T08:38:20.35+00:00

    Hi @Jef Schraag-Halma , Thanks for reaching out. Aure AD B2C User flow or custom policies are compatible with B2C specific Application Registration option "Accounts in any identity provider or organizational directory (for authenticating users with user flows)" as B2C is for consumer-based applications. In client credential scenario, "signInAudience": "AzureADandPersonalMicrosoftAccount" is only supported type with Azure AD B2C for all the users. If you are looking to support users only from your organization, then you can use Microsoft Entra Endpoint to get the access token. https://login.microsoftonline.com/<tenantId>/oauth2/v2.0/token Hope this will help.

    Thanks,

    Shweta


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


0 additional answers

Sort by: Most helpful

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.