Next.js Discord

Discord Forum

My session status is authenticated but nextJS router.push('/dashboard') not working

Unanswered
Cassin's Kingbird posted this in #help-forum
Open in Discord
Cassin's KingbirdOP
Please help. I am created login form using next auth signIn() function when I tried login with correct username and password I got the cookies and my session status is authenticated but router.push in my useEffect not working.

13 Replies

Cassin's KingbirdOP
this is my session status
Cassin's KingbirdOP
I already remove it but still not working
Open the page on a new tab
There is a redirect option in signIn() btw (i think)
signIn("credentials", { ...value, callbackUrl: "/dashboard" })
Sorry about formatting, on mobile
Cassin's KingbirdOP
I add the callback but still..., btw my page seems like refreshing when I press login, but it suppose to running the useEffect right?
no, it is supposed to refresh
as in, after the refresh, if you don't supply the callbackUrl it will run the useEffect
but there will be a refresh
Cassin's KingbirdOP
oh it work, I add session in my useEffect depedency array
thank you for helping