Update secure cookie setting to conditionally use HTTPS protocol in authentication flows
This commit is contained in:
@@ -47,7 +47,7 @@ export const authHook: Handle = async ({ event, resolve }) => {
|
|||||||
path: '/',
|
path: '/',
|
||||||
httpOnly: true,
|
httpOnly: true,
|
||||||
sameSite: 'lax',
|
sameSite: 'lax',
|
||||||
secure: true,
|
secure: event.url.protocol === 'https:',
|
||||||
expires: expiryDate
|
expires: expiryDate
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -106,7 +106,7 @@ function handleSuccessfulLogin(event: RequestEvent<RouteParams, '/login'>, respo
|
|||||||
path: '/',
|
path: '/',
|
||||||
httpOnly: true,
|
httpOnly: true,
|
||||||
sameSite: 'lax',
|
sameSite: 'lax',
|
||||||
secure: true,
|
secure: event.url.protocol === 'https:',
|
||||||
expires: new Date(expiryString)
|
expires: new Date(expiryString)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -93,7 +93,7 @@ export const actions: Actions = {
|
|||||||
path: '/',
|
path: '/',
|
||||||
httpOnly: true,
|
httpOnly: true,
|
||||||
sameSite: 'lax',
|
sameSite: 'lax',
|
||||||
secure: true,
|
secure: event.url.protocol === 'https:',
|
||||||
expires: expiryDate
|
expires: expiryDate
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user