lucia-auth / lucia

Authentication, simple and clean
https://lucia-auth.com
MIT License
8.35k stars 448 forks source link

[Bug]: SessionCookieAttributesOptions missing sameSite: "none" type #1542

Closed Dunkelhaiser closed 2 months ago

Dunkelhaiser commented 2 months ago

Package

lucia

Describe the bug

When creating a new lucia instance, I want to specify cookies sameSite property as "none". Everything works as expected, but when using TypeScript SessionCookieAttributesOptions only has sameSite?: "lax" | "strict" without "none" option. As a result, I get a type error, and additional user attributes( email, createdAt, etc. ) are not added to user type. So this is only a type error, as logic itself works correctly. Also not specifying sameSite or setting it to undefined is not equal to setting it to "none".

const lucia = new Lucia(adapter, {
    sessionCookie: {
        attributes: {
            secure: env.PRODUCTION === true,
            // @ts-expect-error only "none" works but is not included in the interface
            sameSite: "none",
        },
    },
    getUserAttributes: (attributes) => ({
        verifiedAt: attributes.verifiedAt,
        email: attributes.email,
    }),
});