how to get next-auth session in _app.tsx on getInitalProps?
Hi people, I'm using getInitalProps in my _app.tsx, and I need somehow to get session and pass it in SessionProvider, but not sure how, anyone had similar situation?
4 Replies
Did you try to use
unstable_getServerSession()
? I am not sure if it works in _app.getInitalProps
but that the recommended way to get a server side session.
https://next-auth.js.org/configuration/nextjs#unstable_getserversessionNext.js | NextAuth.js
unstable_getServerSession
yes i tries, but I got some weird errors :/
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
@Vinny Thanks, I solved it after a week of debugging why my session is not working properly 🥲