7ocomotive
7ocomotive
BABetter Auth
Created by 7ocomotive on 3/14/2025 in #help
ERROR [Better Auth]: State Mismatch. Verification not found
Thank you for your response, @saze . The mobile Chrome "Desktop site" toggle issue occurs after the user has gone through the entire auth flow, so the state token should already have been deleted by a successful authentication? I wonder if it is a bug? I had also tried passing in a onAPIError.errorURL, but it doesn't redirect to the route provided. Any thoughts?
import { betterAuth } from "better-auth";
import { drizzleAdapter } from "better-auth/adapters/drizzle";

import db from "@/db/index.js";
import { account, session, user, verification } from "@/db/schema";
import env from "@/env";

export const auth = betterAuth({
database: drizzleAdapter(db, {
provider: "pg",
schema: { user, session, account, verification },
}),
emailAndPassword: {
enabled: true,
},
trustedOrigins: ["http://localhost:5173", "https://checklist.benehlert.com"],
socialProviders: {
google: {
clientId: env.GOOGLE_CLIENT_ID,
clientSecret: env.GOOGLE_CLIENT_SECRET,
},
},
onAPIError: {
errorURL: "/some-test-error-route",
},
});
import { betterAuth } from "better-auth";
import { drizzleAdapter } from "better-auth/adapters/drizzle";

import db from "@/db/index.js";
import { account, session, user, verification } from "@/db/schema";
import env from "@/env";

export const auth = betterAuth({
database: drizzleAdapter(db, {
provider: "pg",
schema: { user, session, account, verification },
}),
emailAndPassword: {
enabled: true,
},
trustedOrigins: ["http://localhost:5173", "https://checklist.benehlert.com"],
socialProviders: {
google: {
clientId: env.GOOGLE_CLIENT_ID,
clientSecret: env.GOOGLE_CLIENT_SECRET,
},
},
onAPIError: {
errorURL: "/some-test-error-route",
},
});
6 replies