Wondering how to go to the login page without pressing a button. In the examples, the button is always provided and you have to trigger loginWithRedirect() by clicking a button.
This issue is still valid.
The code below leads to an infinite loop.
if (!isAuthenticated) {
loginWithRedirect();
}
My code:
import React from 'react'
import { App } from './views/App'
import { useAuth0 } from '@auth0/auth0-react'
export const App = () => {
const { loginWithRedirect, isAuthenticated } = useAuth0()
if (!isAuthenticated) {
loginWithRedirect()
}
return <App />
}