Implementing Auth0 as a NodeJS backend with a React frontend

Hi. I’m exploring auth0 and have implemented a fairly simple authentication backend in Nodejs. I have a few questions I hope someone can help me with. Documentation is very good but I am not finding exactly what I want.

1- I have a simple express router with a requiresAuth() middleware. It asks for the user to log in or signup then redirects to a build React folder. Is that the correct way to redirect after authentication? I’m not finding much resources on how to use it with React (as a NodeJS auth backend):

router.get("/dashboard", requiresAuth(), (req, res, next)  {
	res.sendFile(path.join(__dirname, "..", "..", "build", "index.html"));
}

In the React app, I have a React router route (/dashboard) that displays a dashboard component.

2- The way I have auth set up is I import auth from express-openid-connect, define the config and export auth(config). I then call app.use(auth0) in my index.js. I can then use the login and logout routes.

Now when I login or logout, by default, I’m redirected to / (so homepage). Is there a way to overwrite that behavior? I want the login route to direct me somewhere, logout somewhere else.

3- How can I add Facebook and others to the login methods? Currently only Google shows.

4- How does a user sign up? The login route shows a form where you can input your email and password, a forgot password button, and continue with google. Is there a register/signup route built in? And if they do signup, where can I see their username, emails, hashed? password etc.? Basically where are their information and credentials saved, and how can I know they have registered and are able to login, etc.?

5- Can I customize the login form? I tried changing the logo but it didn’t reflect the changes when I was testing locally. And can I change this message: Log in to dev-xz5pbgsq to continue to myapp under the Welcome text, or would that just not show in production?

Apologies for the many questions, but I’m very new to all of this so any help is very appreciated. Thanks

Hi @callum.matthews93,

Welcome to the Auth0 Community!

Is there a reason you are logging in with node? A more typical setup is login with your React app, then make requests to a node backend/API with access tokens. I’m not sure I have a clear understanding of your architecture.

Here’s an example of a React/Express Stack with Auth0: React with React Router 6 (JavaScript) + Express.js (JavaScript) Code Sample: Basic Access Control for Hello World Full-Stack App

To enable Facebook/or other login you simply need to toggle it on in your application’s connection settings (you will also need to configure your own Facebook developer credentials if you haven’t done that yet).


Usually there is a Signup button, but this depends on how you’ve implemented Auth0. A screenshot of your current Auth0 login page may be helpful here.

You can see this info in the Auth0 dashboard under Users. Hashed passwords are available with a support request.

Yes you can customize it.

Not sure about the logo issue, we will need more info to figure out why it isn’t populating. It should be as easy as adding the link and saving it.

Assuming you are using New Universal Login: Customize New Universal Login Text Prompts

1 Like