AD B2C Registration App Redirect URI does not Function

2.4k Views Asked by At

I have a peculiar problem that has been bugging me for a while now. I have a B2C tenant set up with custom policies that uses a multi tenant AD connection as described in the MS docs here: Set up sign-in for multi-tenant Azure Active Directory using custom policies in Azure Active Directory B2C. The B2C tenant is linked to a PowerApps Portal using a web app that is registered within the B2C tenant.

The problem that I am having is that the registration app (that is registered in the parent AD tenant) does not work when I use the recommended redirect uri: https://your-B2C-tenant-name.b2clogin.com/your-B2C-tenant-name.onmicrosoft.com/oauth2/authresp.

The error that I receive is:

AADSTS50011: The reply URL specified in the request does not match the reply URLs configured for the application.

I have found out however that the redirect uri does work when I replace: "your-B2C-tenant-name.onmicrosoft.com" with the directory ID of the B2C tenant.

Now I could be happy that this works and that the Portal (or B2C) gets the redirect uri that it expects but I am far from experienced in this field and so it feels like I am dodging the problem only temporarily.

If anyone has any idea as to why the recommended uri doesn't work and the one with the directory ID does, I would appreciate it a ton.

1

There are 1 best solutions below

1
On

You can use both the ways to configure redirect url

  1.  https://{your-tenant-name}.b2clogin.com/{your-tenant-id}/oauth2/authresp
    
  2. https://{your-tenant-name}.b2clogin.com/{your-tenant-name}.onmicrosoft.com/oauth2/authresp
    

Please see azure-docs/b2clogin.md at master · MicrosoftDocs/azure-docs (github.com)

AADSTS50011: The reply URL specified in the request does not match the reply URLs configured for the application

Above error occurs when url in azure portal doesn’t match the redirect url specified in the application .

Your redirect url in the app must have been configured the 1st way and so when /{your-tenant-name}.onmicrosoft.com is changed to your tenant id , it works and not the other way.Please make sure same url is configured in your app settings, web.config, its references anywhere in the application in a way that it matches redirect url in app registration.(note that reply url is case sensitive ).

Also please recheck the tenant Id of application .