in src/lambda-edge/shared/shared.ts [22:55]
function getDefaultCookieSettings(props: {
mode: "spaMode" | "staticSiteMode";
compatibility: "amplify" | "elasticsearch";
}): CookieSettings {
// Defaults can be overridden by the user (CloudFormation Stack parameter) but should be solid enough for most purposes
if (props.compatibility === "amplify") {
if (props.mode === "spaMode") {
return {
idToken: "Path=/; Secure; SameSite=Lax",
accessToken: "Path=/; Secure; SameSite=Lax",
refreshToken: "Path=/; Secure; SameSite=Lax",
nonce: "Path=/; Secure; HttpOnly; SameSite=Lax",
};
} else if (props.mode === "staticSiteMode") {
return {
idToken: "Path=/; Secure; HttpOnly; SameSite=Lax",
accessToken: "Path=/; Secure; HttpOnly; SameSite=Lax",
refreshToken: "Path=/; Secure; HttpOnly; SameSite=Lax",
nonce: "Path=/; Secure; HttpOnly; SameSite=Lax",
};
}
} else if (props.compatibility === "elasticsearch") {
return {
idToken: "Path=/; Secure; HttpOnly; SameSite=Lax",
accessToken: "Path=/; Secure; HttpOnly; SameSite=Lax",
refreshToken: "Path=/; Secure; HttpOnly; SameSite=Lax",
nonce: "Path=/; Secure; HttpOnly; SameSite=Lax",
cognitoEnabled: "Path=/; Secure; SameSite=Lax",
};
}
throw new Error(
`Cannot determine default cookiesettings for ${props.mode} with compatibility ${props.compatibility}`
);
}