Custom Domains with Auth0 React SDK

Hi there,
I am trying to move an existing tenant to use a custom domain and I cannot seem to make Username/Password authentication work with Universal Login. I have a paid account and have already verified and configured the custom domain.

tl;dr: How do I override the tenant in the login POST request with the React SDK? Is it possible?

Old login URL: <TENANT NAME>.auth0.com
Custom URL: accounts.<TENANT NAME>.com/login

Following the “Configure Features to Use Custom Domains”, I updated the createAuth0Client call with the new domain. When configured, this works with the OAuth social logins, but not the username/password logins. I get “WE’RE SORRY, SOMETHING WENT WRONG WHEN ATTEMPTING TO LOG IN.” error and a 404 error on the POST request to https://accounts.<TENANT NAME>.com/usernamepassword/login.

As mentioned in the troubleshooting video, this is because the tenant in the request is coming from the subdomain accounts. However, from attempting and looking through the documentation and source code, the React SDK does not seem to have the option to override the tenant.

I have attempted with the options below, and many variations thereupon, but no matter what I do, the tenant in the request is still accounts, not <TENANT NAME>. When testing with Postman, I got a 200 response when I used the correct tenant value. I also briefly changed the custom domain to <TENANT NAME>.<TENANT NAME>.com and that worked, but this is not the desired domain.

const auth0 = await createAuth0Client({
  domain: 'accounts.<TENANT NAME>.com',
  client_id: '<CLIENT_ID>',
  overrides: {  __tenant: '<TENANT NAME>', __token_issuer: '<TOKEN ISSUER>' }
});

Welcome to the Auth0 Community, @georgina.hoagland!

First of all, it looks like some of what you wanted to say is missing. Maybe there was some copy&paste misclick or mistype. What did you update exactly and what’s your actual question?

Regarding the scenario you’ve described, I want to clarify that Custom Domains is a paid feature as documented here just in case someone missed it.

Now, if you are entitled to use that feature and you’ve followed our Configure Custom Domains with Auth0-Managed Certificates article, you would have your custom domain verified. I hope we are on the same page at this point.

From your example, I can’t see a valid custom domain. I was hoping to see a subdomain owned by you and not “accounts.com/login”. Something like “login.yourdomain.com” for example.

I don’t know how you are using Auth0, but as you’ve said, all the needed configuration is documented on Configure Features to Use Custom Domains. In case you are using Universal Login without any customization, the new Custom Domain should work out of the box.

Feel free to attach screenshots or more detailed information in case I’ve misunderstood your use case.

Hi Ale,
Thanks for your speedy reply - yes I accidentally posted while still writing. I do have a paid account and my custom domain is configured and verified. I have followed the “Configure Custom Domains with Auth0-Managed Certificates”, but this has not resolved my issue.

Hi @Ale ,
We seem to be facing a similar issue as @georgina.hoagland . We are using the the React SDK and using the Auth0 domain. We want to switch to the custom domain, which was successfully verified and says “ready” in the tenant settings.

Then when we switched the ‘domain’ parameter in the Auth0Provider from p2b.eu.auth0.com to login.nafirmy.cz, the SDK successfuly redirects to the login form on the custom (sub)domain, but it won’t let me log in and I can see that it’s the POST request to https://login.nafirmy.cz/usernamepassword/login that returns NotFoundError 404.

What are we missing here?

Hello,
Is there any update regarding this? I’m in the exact same situation than @vojtech.hejda
Regards

1 Like

Hello,

@josue , @vojtech.hejda - do you have any progress on that? I have the same issue as @josue, probably you already fixed it?

@Ale , any updates on that issue?

try to delete all audiences in your code (in getSilentlytoken , …)