Azure B2C Owin redirect_uri_mismatch when using custom domain

New Contributor

I have configured an MVC application using the Owin components to authenticate users against Azure B2C.  Everything works just fine when using the URL.


Now, we've added a custom domain name ( to the web application and bound an SSL certificate to the site.  I have updated the B2C application Reply URL from to and configured web.config to use this URI as the reply URL for authentication requests as well. 


When browsing to the site using the custom domain name, I am now put in an endless request loop with  Using Fiddler, I can see that the request to has the correct redirect_uri parameter pointing to    However, the response indicates "The redirect URI provided in the request is not registered for the client id..."


Here is where the confusion is...  the URL in the error message is something that we don't have configured anywhere and doesn't exist in the request...  from what I can tell, it is formed by concatenating the hostname (myapp) with the tenant name (appname) and  So based on the obfuscated values I've described here, my redirect_uri sent in the request is and the error says that is not registered.


Why is coming up with that for the redirect, and why doesn't it respect the value provided in the Azure Portal for the B2C application, along with the matching URL being sent in the request?


To be clear, when I revert back to using just the version of the names, it work fine.  It appears to be something with the custom domain name that is not compatible.


Any help would be greatly appreciated.

Thanks in advance...


1 Reply

UPDATE: I determined that because the B2C directory was setup with a custom domain name of, there must have been an internal translation of that domain to the resource name ( -->


This was confirmed by sending that redirect URL in the request, but configuring the B2C application reply URL to  There was no problem that the parameter didn't match up to the reply URL configured in B2C, but obviously I simply received a 404 since doesn't exist.


By creating a brand new B2C tenant/directory, and using only the resource name (no custom domain on the directory), the original problem has been resolved.