⚡️⚡️⚡️ Self-hosted collaborative bookmark manager to collect, read, annotate, and fully preserve what matters, all in one place.
TypeScript bookmarkbookmark-managercollaborationnextjsreact-nativeread-it-laterself-hostedtypescript
add secure cookie handling for authentication
daniel31x133a7cdd39c694
diff --git a/apps/web/pages/api/v1/auth/[...nextauth].ts b/apps/web/pages/api/v1/auth/[...nextauth].tsindex af2ec07e..0fdfdd80 100644--- a/apps/web/pages/api/v1/auth/[...nextauth].ts+++ b/apps/web/pages/api/v1/auth/[...nextauth].ts@@ -81,6 +81,8 @@ const adapter = PrismaAdapter(prisma);const STRIPE_SECRET_KEY = process.env.STRIPE_SECRET_KEY;const providers: Provider[] = [];+const useSecureCookies = process.env.NEXTAUTH_URL?.startsWith("https://");+const cookiePrefix = useSecureCookies ? "__Secure-" : "";if (process.env.NEXT_PUBLIC_CREDENTIALS_ENABLED !== "false") {// undefined is for backwards compatibility@@ -1325,6 +1327,18 @@ export default async function auth(req: NextApiRequest, res: NextApiResponse) {signIn: "/login",verifyRequest: "/confirmation",},+ cookies: {+ pkceCodeVerifier: {+ name: `${cookiePrefix}next-auth.pkce.code_verifier`,+ options: {+ httpOnly: true,+ sameSite: useSecureCookies ? "none" : "lax",+ path: "/",+ secure: useSecureCookies,+ maxAge: 60 * 15,+ },+ },+ },callbacks: {async signIn({ user, account, profile, email, credentials }) {if (!(user as User).emailVerified && !email?.verificationRequest) {