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
lelabo
lelabo•3y ago
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_getserversession
Next.js | NextAuth.js
unstable_getServerSession
Bozic0909
Bozic0909OP•3y ago
yes i tries, but I got some weird errors :/
Unknown User
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
Bozic0909
Bozic0909OP•3y ago
@Vinny Thanks, I solved it after a week of debugging why my session is not working properly 🥲
Want results from more Discord servers?
Add your server