Use __Secure cookie prefix
See https://www.sjoerdlangkemper.nl/2017/02/09/cookie-prefixes/
This commit is contained in:
parent
3e6748f94b
commit
1845db2da3
|
@ -20,7 +20,7 @@ const multiAuthMiddleware = (request) => {
|
|||
const cookiePointerName = 'multi_auth.user-id'
|
||||
const hasCookiePointer = request.cookies?.has(cookiePointerName)
|
||||
// is there a session?
|
||||
const sessionCookieName = 'next-auth.session-token'
|
||||
const sessionCookieName = '__Secure-next-auth.session-token'
|
||||
const hasSession = request.cookies?.has(sessionCookieName)
|
||||
|
||||
if (!hasCookiePointer || !hasSession) {
|
||||
|
|
|
@ -251,7 +251,7 @@ export const getAuthOptions = (req, res) => ({
|
|||
},
|
||||
cookies: {
|
||||
sessionToken: {
|
||||
name: 'next-auth.session-token',
|
||||
name: '__Secure-next-auth.session-token',
|
||||
options: {
|
||||
httpOnly: true,
|
||||
sameSite: 'lax',
|
||||
|
|
|
@ -11,7 +11,7 @@ export default (req, res) => {
|
|||
const cookiePointerName = 'multi_auth.user-id'
|
||||
const userId = req.cookies[cookiePointerName]
|
||||
// is there a session?
|
||||
const sessionCookieName = 'next-auth.session-token'
|
||||
const sessionCookieName = '__Secure-next-auth.session-token'
|
||||
const sessionJWT = req.cookies[sessionCookieName]
|
||||
|
||||
if (!userId || !sessionJWT) {
|
||||
|
|
Loading…
Reference in New Issue