Next.js Discord

Discord Forum

Auth JS - Update State

Answered
Transvaal lion posted this in #help-forum
Open in Discord
Transvaal lionOP
I have a website where a user has many organizations. I'm using Next Auth JS for oauth. After a user creates an account, it asks them to create an organization during onboarding. Where should I store this organization id? Is there a way to update my auth session to store it in the payload so I can read it both server and client side? Should I store it in my cookies somewhere? Or is there a better alternative? Curious to some feedback on architecture here. Thanks!
Answered by Transvaal lion
in next auth, you can update session client side and trigger a callback to update it server side as well
View full answer

2 Replies

Transvaal lionOP
Prior to using next js, I would just have a global context wrapping my app where i stored currentOrganization
Transvaal lionOP
in next auth, you can update session client side and trigger a callback to update it server side as well
Answer