Auth0 login undefined/authorize?redirect

I am creating a fullstack application with a react front end (NOT FROM CREATE REACT APP), express, nodeJS and mySQL. I followed all the steps in setting up a simple login button for react using a .env file, const domain, const clientId and with @auth0/auth0-react but when I start my server on localhost, and then run my webpack to build the bundle, and then access the application on the localhost:port, I click login and it says: " This site can’t be reached

undefined ’s server IP address could not be found.

DNS_PROBE_FINISHED_NXDOMAIN" .

The URL shows https://undefined/authorize?redirect_uri=http....etc. etc. What could be the problem here?

1 Like

Hey @akshajmody,

Looks like the /authorize url is not picking up the auth0 domain. How does it get populated in your app?
Looks like need to debug first on why domain is not getting populated.

Ideally it should be : https://<your_auth0_domain>/authorize?redirect_uri=http…etc.

Regards,
Sidharth

1 Like

it shows undefined in the URL once I click login. I literally followed this step by step:

Would having an express server have anything to do with this?

Maybe my .env variables of domain and client Id aren’t being read in my index.jsx file?

Yeah it will be worth checking if the variables domain and clientID are being populated from the .env file.

I’m not sure if they are. I have my .env file with the correct credentials but do you know of a reason why my react component would not be able to read those .env file? I do have the npm dotenv package installed. Would I need to require something in the components itself to have them understand the variables in the .env file?

Any idea if it would be an issue with my front end not pulling from .env file? Given that the redirect is not working

If you are using Create-react-app and you can’t pull the variable, you need to make sure that your .env variables start with link

REACT_APP_

Thanks for sharing that with the rest of community!

same error , have u find solution

If you’ve made changes to the .env file you need to stop the react application and run it again with npm start.

1 Like

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.