Updating server session
Unanswered
Yacare Caiman posted this in #help-forum
Yacare CaimanOP
From an API route, I am using...
However, those values are not available from other server-side pages...
How to update the server session so that values are retained?
const session = await getServerSession(req, res, authOptions);
session.foo = "bar";However, those values are not available from other server-side pages...
// returns undefined
console.log(session.foo);How to update the server session so that values are retained?
4 Replies
Cape horse mackerel
Shouldn't you update session within
callbacks next-auth function?Yacare CaimanOP
Are you referring to the callbacks like
async jwt(...) and async session(...)?Cape horse mackerel
yes
Yacare CaimanOP
The data I want to persist across the server session is received as a query string on an api page. How to get that variable to the next-auth callbacks function?