Hey there, my ReactJS App is infinitely looping after login. Loops between my homepage and then the Auth0 login page. I have this error in incognito, and regular. Also have error with all browser.
Below is code snippets. Any thoughts?
import { Auth0Provider } from ‘@auth0/auth0-react’;
App.js
const root = ReactDOM.createRoot(document.getElementById('root'));
root.render(
<Auth0Provider
domain="dev-1v7prir5.us.auth0.com"
clientId="8dlquRgNeFZqx9TgkaYPR7U3tTKCENaS"
redirectUri={window.location.origin}
cacheLocation="localstorage"
useRefreshTokens={true}
>
<App />
</Auth0Provider>
Homepage
export default withAuthenticationRequired(Homepage)
My login page that redirects user
const LoginIdentity = () => {
const { loginWithRedirect, isLoading, error} = useAuth0();
// used for navigation
useEffect(() => {
loginWithRedirect()
},[]);
if (isLoading) {
return <div>Loading...</div>;
}
if (error) {
return <div>Oops... {error.message}</div>;
}
}
export default LoginIdentity