export defaultCookies
#8801
clausreinke
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Goals
cookiesoption (start withnext-authdefaults, only touch/change what is needed)next-authcookies handling or risk introducing security issues just to change cookie namescookiesoption Better cookie options #6942as suggested in #6942 (comment), the combination of the existing
cookiesoption and the not-yet-exporteddefaultCookiesshould make it easy to implement these and similar requestsNon-Goals
Background
cookiesoption,next-authis used to make authentication easier, butcookiesone would have to take control of every aspect;there is clearly a gap between what
next-authusers consider easy and what the authors consider such;after search the existing discussions/issues, it was #6942 (comment) that seemed to offer an out of this stalemate, suggesting to start with
defaultCookies:next-auth/packages/next-auth/src/core/lib/cookie.ts
Lines 56 to 119 in 7ba986b
unfortunately, this module is not exported from the package, which is what this feature request is trying to address, but here is an example of port-specific cookie names (with a hackish import to bypass the missing export; you'll need to address the option in both
/pages/api/auth/[...nextauth].tsand inmiddleware.ts):exporting
defaultCookieshas been suggested before #6043, #3568, with the argument against being #3568 (comment):I think this argument is clearly false:
cookiesoption is available for changenext-authideasnext-authupdatesnode_modulesdirectly](getSession call does not trigger session object update until window loses focus #596 (comment))Proposal
make
defaultCookiesavailable as an export of packagenext-authBeta Was this translation helpful? Give feedback.
All reactions