feat: Handle splitted next-auth.session-token cookie
๐ Linked issue
#139 #160
โ Type of change
- [ ] ๐ Documentation (updates to the documentation, readme or JSdoc annotations)
- [x] ๐ Bug fix (a non-breaking change that fixes an issue)
- [ ] ๐ Enhancement (improving an existing functionality like performance)
- [x] โจ New feature (a non-breaking change that adds functionality)
- [ ] ๐งน Chore (updates to the build process or auxiliary tools and libraries)
- [ ] โ ๏ธ Breaking change (fix or feature that would cause existing functionality to change)
๐ Description
- Module options fills the runtimeConfig (private and public).
-
RuntimeConfigtypings updated. -
useAuth'ssessionTokenreturns the cookie handled bymakeSessionCookie(handles splitted session token). -
NuxtAuthHandlerusesgetAuthJsSecretif receives no token fromAuthConfig. -
getServerTokenusesmakeCookiesFromHeadersto manage cookies. - Added end edited some utils:
- A -
getAuthJsSecret: gets the secret from runtime or env vars. - A -
getConfigBaseUrl: gets the baseUrl from runtime or env vars. - M -
checkOrigin: uses getConfigBaseUrl - M -
getServerOrigin: uses getConfigBaseUrl. - A -
mergeCookieObject: merges cookies. - A -
makeSessionCookie: gets the next-auth.session-token (handles splitted session token). - A -
makeCookiesFromHeaders: manage multiple 'set-cookie' and makes native Headers. - M -
makeNativeHeaders: made it an utility. - M -
makeNativeHeadersFromCookieObject: uses makeNativeHeaders.
- Added some tests.
Resolves the 'getServerToken returns null issue'.
#139 #160
๐ Checklist
- [x] I have linked an issue or discussion.
- [ ] I have updated the documentation accordingly.
@Hebilicious Any progress on this PR? I am having the issue with getServerToken returning Null on the current npm version ๐ฟ
Thanks for this wonderful package, I hope to continue to use this.
@Hebilicious Any progress on this PR? I am having the issue with getServerToken returning Null on the current npm version ๐ฟ
Thanks for this wonderful package, I hope to continue to use this.
Hello there. The problem is that I don't personally use auth.js anymore and I have no easy way to test if this PR will break existing code ... I'm also no longer maintaining this package, as the auth.js team never moved forward with their plans. Now issues are piling up and I don't have the time, the incentive or the desire to fix them. If someone is willing to test this PR, I would merge it.