next session is lost on refresh
Hi people,
I have a problem that my session is lost on page refresh. I have getInitalProps in my _app.tsx and I can't manage to get session from there and pass it in SessionProvider
I have tried getSession and ustable_getServerSession but both don't work.
Is there any workaround, for this?
7 Replies
No clue what you done since you don’t share code, my guess is use the useSession hook?
you mean lost as if you need to sign in again or you get loading state for a bit?
I will share a code example and errors i get in 10-15 mins, i want server session
are you using trpc?
with getInitialProps it should look something like t his
I have still "logged in" state in my navbar, but i get unauthorized errors whenever i need to pass jwt to request
No i dont use trpc, its next.js next auth and axios
ok so omit the last line and just export the app unwrapped
Ok, thanks, will try
sry for late update, yeah that solved problem thank you 😄