Page Reloads in Next Auth
Unanswered
Masai Lion posted this in #help-forum
![Avatar](https://cdn.discordapp.com/embed/avatars/3.png)
Masai LionOP
I am using next auth for authentication. When login is successful it redirects to another page. But before redirecting the login page reloads and then only it redirects to another page.How to stop this reloading behaviours.#nextauth
githubrepo:- https://github.com/drb1010/auth-demo
githubrepo:- https://github.com/drb1010/auth-demo
4 Replies
![Avatar](https://cdn.discordapp.com/avatars/998522171813011486/301889edae1fdb98789ce7188f03ca16.webp?size=256)
Santhosh Prabhakaran
After changing the isLoggedIn state, the useEffect runs again because of the dependancy array.
![Avatar](https://cdn.discordapp.com/embed/avatars/3.png)
Masai LionOP
still the problem exists after removing dependency from useEffect.Please help me.
username:admin@example.com
pwd:- 123
username:admin@example.com
pwd:- 123
![Avatar](https://cdn.discordapp.com/avatars/998522171813011486/301889edae1fdb98789ce7188f03ca16.webp?size=256)
Santhosh Prabhakaran
Instead of using the state try to use the session itself to validate
![Avatar](https://cdn.discordapp.com/embed/avatars/3.png)
Masai LionOP
i am validating in root component so i cant use useSession hook.can you give me some idea to achive this using getSession