React app with Node login

I have a React app where login is done by following this tutorial: Auth0 React SDK Quickstarts: Login and it works very well.

However, now I have a requirement to do the following: on page load, check if user is authenticated on server level. If not, redirect to Auth0 login, else serve the React app. So, I’ve implemented login from the Node server and the callback after a successful login takes me to the React app with code and state querystrings. However, it’s not recognized as a valid state, maybe because the origin of the login was not the React app. Any way around this?

Thanks!