Share via

Azure AD B2C and OpenID Connect for native application

Ben Napper 0 Reputation points
2024-06-18T11:34:21.58+00:00

Hi,

I am trying to add authentication to my native mobile application using OpenID Connect protocol and my Azure AD B2C identity provider. I have followed the guide to create custom policies and added a Userinfo endpoint such that it appears in my discovery URL https://learn.microsoft.com/en-us/azure/active-directory-b2c/userinfo-endpoint?pivots=b2c-custom-policy

I have also read the information on https://learn.microsoft.com/en-us/azure/active-directory-b2c/openid-connect

I need the login to redirect to localhost:4000 where my app will finish the process. I have added localhost:4000 to the redirect URIs for my Azure application.

My issue is when I login using the oauth2 authorize endpoint to test the process using a URL with a format:

https://<tenant>.b2clogin.com/<tenant>.onmicrosoft.com/oauth2/v2.0/authorize?client_id=<client_id>&nonce=defaultNonce&redirect_uri=http%3A%2F%2Flocalhost%3A4000%2F&scope=openid&response_type=id_token&prompt=login

After login I don't receive a code - in the address bar the URL has changed to localhost:4000 (which is correct) but there is a "server_error AADB2C: An exception has occurred." message with a correlation ID of e05d852f-03a1-4ae5-ac86-d3d7bef1ac2e

http://localhost:4000/#error=server_error&error_description=AADB2C%3a+An+exception+has+occurred.%0d%0aCorrelation+ID%3a+e05d852f-03a1-4ae5-ac86-d3d7bef1ac2e%0d%0aTimestamp%3a+2024-06-17+23%3a29%3a20Z%0d%0a

What exception has occurred? Could you please assist?

Microsoft Security | Microsoft Entra | Microsoft Entra ID
{count} votes

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.