After logging in, if the user clicks on the go back button from the browser, they'll be redirected back to login page.
I've tried setting router.push:
if (session) {
router.push('/homepage');
}
return (
<div>
<Button
fullWidth
sx={{ textTransform: 'none' }}
variant="outlined"
startIcon={googleIcon}
onClick={() => signIn('google', { callbackUrl: '/homepage' })}
>
Entrar usando a conta do Google
</Button>
</div>
);
But it doesn't work properly. It goes back to login page for a sec and then redirects the user to /homepage.
CodePudding user response:
You could replace
the location when the user logs in, this would result in the /login
page not being in the history when the user tries going back.
CodePudding user response:
Perhaps the variable session
receives a value that understands as a true
value. For this reason, the condition is met and a redirect to the home page occurs