Auth0 Home Blog Docs

Redirecting Straight to Auth0 Hosted Login Page



Hi, I’ve been trying to redirect immediately to the hosted login page without a preliminary page. When I run the code it takes me directly to the hosted login page, but after logging in it takes me back to the hosted login page. If I login again it takes me inside my application. I don’t understand why my first login attempt fails. My code is based on the Auth0 react tutorial. const handleAuthentication = ({ location }) => { if (/access_token|id_token|error/.test(location.hash)) { auth.handleAuthentication(); } } export const makeMainRoutes = () => { if (!auth.isAuthenticated()) {

} return (

 <Route path="/" render={(props) => <App auth={auth} {...props} />} />

 <Route path="/home" render={(props) => <Home auth={auth} {...props} />} />
 <Route path="/callback" render={(props) => {
   return <Callback {...props} />
 }} />
 <Route path='/stories' component={StoryPage}/>

); Any input would be appreciated.