Better Auth

BA

Better Auth

Join the community to ask questions about Better Auth and get answers from other members.

Join

bug-reports

help

Google Provider prompt parameter type mismatch causes OAuth error

I'm encountering an issue with the Google OAuth provider configuration in better-auth. According to the documentation, to always get a refresh token, I should set prompt to "select_account+consent" as in documentation, but this causes a Google OAuth error. ``` socialProviders: { google: { clientId: process.env.GOOGLE_CLIENT_ID as string,...

How to use better auth in two frontend and one backend

I have a monorepo where I have two react router v7 frontend projects both using same Hono backend and better auth backend. The problem is when I sign in to my web frontend it also signs me in to my admin frontend project. how can I keep them separate?...

authClient.emailOtp.verifyEmail(), wrong endpoint "/email-verification"

Why does authClient.emailOtp.verifyEmail() keep sending to the regular endpoint /email-verification and NOT /email-otp/verify-email​ endpoint? I keep getting METHOD NOT ALLOWED, which makes sense as /email-verification is a GET, but I am sending a POST. Because I am expecting the authClient to hit /email-otp/verify-email, which is a POST....

Problem when deploying authentication on the server

Hello. I have a vuejs application that uses authentication via better auth, deployed with express. When I tested with my local dev server, everything worked perfectly....
No description

Modify user creation

How could hook into the user creation process to modify the image url since I am using custom oauth wich doesn't return an image url so i would like to pull an image from granatar and use that
Solution:
i figured out to use database hooks

How can I extend the organization plugin schema ?

I want to extend the schema of the organization plugin to include custom fields. By default, it includes name, slug,logo and metada but I need to support additional fields for each organization, like: - description - schedule - socials...

Help with "adminRoles"

I configured it: ``` plugins: [ admin({...

auth.api.changeEmail updates email immediately even when user is verified (unlike client flow)

Steps to reproduce: 1. Set up Better Auth with changeEmail.enabled: true and a working sendChangeEmailVerification function. 2. Call this on the server: ...

Multi-Tenant Authentication Issue: User Login Conflicts with Same Email Across Different Tenants

I'm building a multi-tenant application using Better Auth with a single database approach. I'm using tenant_id to separate data between organizations. However, I'm facing a critical authentication issue when users belong to multiple organizations. ```sql -- Users table CREATE TABLE users ( id UUID PRIMARY KEY,...

change UserId on admin plugin

Hi all. i'm using mongodb as my database adatapter. I' ve created my custom logic where a custom session is created once the client logs in with discord. In my custom logic i grant access to the user only if there's a record on another collection of the database . if so , the authentication flow continues and better -auth generates all the records it needs. now , i want to use the admin plugin, i managed to set it up , however i need the userID generated by better auth to be able to delete the records accordingly. i want to use the discord client id . is it possible?...

Better Auth 1.2.9 + Prisma: P2000 error when login

Hi everyone, I'm using Better Auth v1.2.9 with Prisma as the adapter, and I'm encountering a PrismaClientKnownRequestError (P2000) when trying to log in using the Discord provider. Here's the relevant error log: SERVER_ERROR: PrismaClientKnownRequestError: ...

Advice: how to authenticate high-frequency endpoints?

I have an api endpoint which is being hit very frequently (/api/thumbnail/:provider/:id). That endpoint needs to fetch the account associated with that provider (e.g. getting/refreshing the access token) and then makes an api request to the provider (e.g. google drive) with the bearer token, etc. Alas, this is overwhelming supabase and I'm getting 504 errors 😦 What should I do? I'd like not to re-invent the wheel so perhaps someone can give me some advice?...

Middleware error on cluster deployment with Docker.

Hey guys I have a problem. My Nextjs app with better auth will not work correctly on my server enviroment. On vercel everything works perfect but on my server cluster it gets an 500 ssl error. This is my middleware code: ```import { betterFetch } from "@better-fetch/fetch"; import { NextResponse, type NextRequest } from "next/server"; ...

Add metadata to subscription using stripe plugin

In our application, a user can pay for other users. Once someone is tagged as a consumer, they are considered subscribed. To handle this, we created a view where a user can select other users to subscribe. ...

User role property in Organization plugin

Hey, I'm trying to setup the Organization plugin and I want to only let admin/superadmin roles be able to create new orgs using the allowUserToCreateOrganization However, the role property doesn't seem to exist on the user type, even though I have added the admin plugin and migrated the changes on DB. But I still get this error: Property 'role' does not exist on type '{ id: string; name: string; emailVerified: boolean; email: string; createdAt: Date; updatedAt: Date; image?: string | null | undefined; }'.ts(2339)...

How to generate a custom userID on registration

Can I provide a custom ID when a user signs up? (or ideally call a custom endpoint so that my database generates it naturally) context: my database uses a custom primary key type...

Issue sign in with Microsoft

``` ERROR [Better Auth]: { error: 'invalid_request', error_description: "AADSTS90023: Public clients can't send a client trace_id Correlation ID: correlation_id Timestamp: 2025-07-17 06:21:43Z", error_codes: [ 90023 ],...
No description

Getting INVALID TOKEN on Reset Password

I'm getting the URL, but when i go it always says INVALID TOKEN. The request is there, the token is there and is valid. The code snippet is attached in the images....
No description

onLinkAccount not triggered when linking anonymous user with social account (BetterAuth v1.2.12)

Hi, I'm running into a problem likely related to #1457. I am building an app using Expo ~53.0.9 on the client and Hono ^4.7.11 on the server. BetterAuth version is v1.2.12. ...

Cookies doesn't works in production mode

Hello everyone, my auth works fine in dev mode, I have an API with hono and a Front with Nextjs, my auth config looks:
No description