azureauthenticationazure-ad-b2cazure-ad-msalidentity-provider

Azure AD B2C login with Microsoft identity provider error: Proof Key for Code Exchange is required for cross-origin authorization code redemption


I am getting this error on Azure AD B2C login with Microsoft identity provider:

AADB2C90273: An invalid response was received : 'Error: invalid_request,Error Description: Proof Key for Code Exchange is required for cross-origin authorization code redemption.'

enter image description here

I have added web redirect url like this:

enter image description here

I tried many ways find on google, stack overflow and others, but nothing seems to be working.

Please help me solve this error.

Thanks in advance


Solution

  • To configure Microsoft Account as the IDP, you need to register the application in Microsoft Entra ID tenant (Azure AD tenant):

    Add redirect URL as https://your-tenant-name.b2clogin.com/your-tenant-name.onmicrosoft.com/oauth2/authresp

    enter image description here

    And supported account types: Personal Microsoft accounts only:

    enter image description here

    Create Azure AD B2C application in the Azure AD B2C tenant and added redirect URI as https://jwt.ms

    enter image description here

    Now create the IDP by passing the Azure AD application ID and secret value in the Microsoft Entra ID tenant (Azure AD tenant):

    enter image description here

    Run user flow by selecting the IDP:

    enter image description here

    Select Microsoft Account:

    enter image description here

    The user is now able to sign-in successfully and ID token is generated:

    enter image description here

    If you want to fetch access tokens along with ID token, then you need to Expose an API and scope in the Azure AD B2C application:

    enter image description here

    Grant API permission for the scope:

    enter image description here

    While running the user flow, select resource as your b2c application and run:

    enter image description here

    Now both ID and access tokens will be generated when the user will sign in:

    enter image description here