From af078e74f46e81fe9fe1ab61d9f9844e4912f110 Mon Sep 17 00:00:00 2001 From: Hui Zhao Date: Tue, 18 Jun 2024 10:14:55 -0700 Subject: [PATCH] fix(aws-amplify): createKeyValueStorageFromCookieStorageAdapter misses default path and secure values --- .../createKeyValueStorageFromCookieStorageAdapter.ts | 2 ++ .../src/adapterCore/serverContext/types/cookieStorage.ts | 8 +++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/packages/aws-amplify/src/adapter-core/storageFactories/createKeyValueStorageFromCookieStorageAdapter.ts b/packages/aws-amplify/src/adapter-core/storageFactories/createKeyValueStorageFromCookieStorageAdapter.ts index 9cfd141c47c..54e9a80dc58 100644 --- a/packages/aws-amplify/src/adapter-core/storageFactories/createKeyValueStorageFromCookieStorageAdapter.ts +++ b/packages/aws-amplify/src/adapter-core/storageFactories/createKeyValueStorageFromCookieStorageAdapter.ts @@ -10,6 +10,8 @@ import { export const defaultSetCookieOptions: CookieStorage.SetCookieOptions = { // TODO: allow configure with a public interface sameSite: 'lax', + secure: true, + path: '/', }; const ONE_YEAR_IN_MS = 365 * 24 * 60 * 60 * 1000; diff --git a/packages/core/src/adapterCore/serverContext/types/cookieStorage.ts b/packages/core/src/adapterCore/serverContext/types/cookieStorage.ts index 6069c749903..e93124d41d0 100644 --- a/packages/core/src/adapterCore/serverContext/types/cookieStorage.ts +++ b/packages/core/src/adapterCore/serverContext/types/cookieStorage.ts @@ -7,7 +7,13 @@ export declare namespace CookieStorage { export type SetCookieOptions = Partial< Pick< CookieSerializeOptions, - 'domain' | 'expires' | 'httpOnly' | 'maxAge' | 'sameSite' | 'secure' + | 'domain' + | 'expires' + | 'httpOnly' + | 'maxAge' + | 'sameSite' + | 'secure' + | 'path' > >;