Handling cache with authentication
Unanswered
Masai Lion posted this in #help-forum
Masai LionOP
Hey,
I'm using AuthJS with Next.js 14, and I'm encountering an issue with Server Components opting out of caching when calling the auth() function (due to cookies, it seems).
https://nextjs.org/docs/app/building-your-application/caching#invalidation-1
I tried moving the auth() function into the fetch function itself, but I'm still experiencing the same behavior.
Is there any way to cache the session? How do you handle this issue?
Thanks!
I'm using AuthJS with Next.js 14, and I'm encountering an issue with Server Components opting out of caching when calling the auth() function (due to cookies, it seems).
https://nextjs.org/docs/app/building-your-application/caching#invalidation-1
I tried moving the auth() function into the fetch function itself, but I'm still experiencing the same behavior.
Is there any way to cache the session? How do you handle this issue?
Thanks!