Better AuthBA
Better Auth7d ago
3 replies
ik.mik.loreland

TanstackStartCookies plugin not working

Hi there,

I am trying to implement Better-Auth into my Tanstack Start app and I got some weird behaviour going on with email signin. I can signin with email and password when I set rememberMe=true. No problems whatsoever. But when I set rememberMe=false the session_token cookie is not being set, only the dont_remember cookie flag.

Ik have tried to reproduce this with a NextJS app, but on the NextJS variant, everything works fine. It set's both the session_token cookie as the dont_remember cookie flag. So it seems like there is an issue with the tanstackStartCookies() plugin from Better-Auth.

versioning:

Tanstack Start: 1.149.0 (with nitro and vite)
Better-Auth: 1.4.11


- I am using Drizzle as my ORM with a local containerized Postgress database.
- My dev browser is Arc (Google Chrome based), but tested it in other browser as well. Not working there too.
- I use a very minimal setup for testing, these are all auth settings:

auth.ts
import { betterAuth } from "better-auth";
import { drizzleAdapter } from "better-auth/adapters/drizzle";
import { tanstackStartCookies } from "better-auth/tanstack-start";
import { db } from "@/db";
import * as authSchema from "@/db/schemas/auth-schema";


export const auth = betterAuth({
    database: drizzleAdapter(db, {
        provider: "pg",
        schema: authSchema,
    }),
    emailAndPassword: {
        enabled: true,
    },
    plugins: [tanstackStartCookies()],
});


authClient.ts
import { createAuthClient } from "better-auth/react";

export const authClient = createAuthClient({
    baseURL: process.env.BETTER_AUTH_URL,
    plugins: [],
});


Furthermore I have a very simple loginform just for testing purposes. Just a form that calls await authClient.signIn.email({...}). I used the exact same login on the nextjs variant, only with the nextjs plugin.

Is this a know issue?

Cheers,

Mik
Was this page helpful?