Azure B2C authorize check via ajax

Manuel Heye 1 Reputation point
2023-01-20T10:45:45.9133333+00:00

Hi

How is it possible to make an authorize check to [https://TENTANT.b2clogin.com/TENTANT.onmicrosoft.com/oauth2/v2.0/authorize via ajax to verify if a customer has an active session on azure AD, i only need to retrieve the azure oid from the token.

Now i redirect the user to [https://TENTANT.b2clogin.com/TENTANT.onmicrosoft.com/oauth2/v2.0/authorize?p=B2C_1_sign_in&client_id=CLIENTID&none=defaultNonce&redirect_uri=REDIRECTURI&scope=openid&response_type=id_token&prompt=login&response_mode=form_post&ui_locales=en but i want to get rid of that.

Greetings Manuel

Microsoft Entra ID
Microsoft Entra ID
A Microsoft Entra identity service that provides identity management and access control capabilities. Replaces Azure Active Directory.
19,467 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Shweta Mathur 27,456 Reputation points Microsoft Employee
    2023-01-24T08:45:40.08+00:00

    Hi @Manuel Heye ,

    Thanks for reaching out.

    I understand you are trying to get the Azure AD B2C token to retrieve oid.

    Unfortunately, it is not possible to authenticate the user without required parameters. These parameters specify what type of token is being requested to use by proper audience.

    To get the token, you need to call authorize endpoint with the required parameters which will provide you authorize code to redeem the token from the /token endpoint.

    Thanks,

    Shweta

    Reference: [https://learn.microsoft.com/en-us/azure/active-directory-b2c/authorization-code-flow


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