redirectURL not working on email signIn

signing in works fine, session shows up in storage, but the redirect doesn't work. been at this for like an hour, confident everything is configured correctly, but clearly not lol:

// signin.tsx
import { auth } from "~/lib/auth";

async function signinAction(formData: FormData) {
  "use server";

  const email = formData.get("email") as string;
  const password = formData.get("password") as string;

  try {
    await auth.api.signInEmail({
      body: {
        email,
        password,
        callbackURL: "/dashboard",
      },
    });
  }
  catch (error) {
    console.error("Signup error:", error);
  }
}


// auth.ts
import { betterAuth } from "better-auth";
import { drizzleAdapter } from "better-auth/adapters/drizzle";
import { nextCookies } from "better-auth/next-js";

import { db } from "./db";
import * as schema from "./db/schema";

export const auth = betterAuth({
  database: drizzleAdapter(db, {
    provider: "sqlite",
    schema,
  }),
  emailAndPassword: {
    enabled: true,
  },
  advanced: {
    database: {
      generateId: false,
    },
  },
  plugins: [nextCookies()],
});
Was this page helpful?