Login via API with Custom Domains - invalid domain x for clientId y


I have introduced custom domain in Auth0. For the sake of the discussion, let’s say that my auth0 domain was:
and custom domain is

Before custom domains, I used ${auth0.domain}/oauth/token with password grant to login as a user via the API:

"client_id": "hidden",
"audience": "https://rafal.audience.com",
"username": "rafal@rafal.com",
"password": "123456",
"grant_type": "password",
"scope": "openid profile email"

With above I had no troubles generating a token. The token was issued with auth0 domain. Now, since I’ve introduced Custom Domains, I would like to login via the API with custom domain so the issuer of the token matches the one expected by my Backend services.

When I try to run the same request for custom domain, I get following error:
Status code: 400
“error”: “invalid_request”,
“error_description”: “Invalid domain ‘login.rafal.com’ for client_id 'hidden”

Did I do something wrong? Maybe I am missing some configuration. I read in the documentation that /oauth/token endpoint is compliant with custom domains.

Thank you in advance

Solution: Invalid client Id. I mixed up the environments facepalm

1 Like

No worries! We’ve all been there! Thanks for sharing that with the rest of community!

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.