Better Auth

BA

Better Auth

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

Join

bug-reports

help

Is there a way to access the `event` object from hooks in Nuxt / Nitro?

I have an application that sends an email to the user when they register in the databaseAfter hook. I am using @nuxtjs/i18n and need to use the event object for the language of the email. Is there a way to do this?

(on middleware) [Better Auth]: INTERNAL_SERVER_ERROR Error: Failed query

2025-08-10T13:39:59.581Z ERROR [Better Auth]: INTERNAL_SERVER_ERROR Error: Failed query: select "id", "expires_at", "token", "created_at", "updated_at", "ip_address", "user_agent", "user_id", "impersonated_by" from "session" where "session"."token" = $1
params: 7lIiWUkRjrVmOh4UJ0rZgjrvITaKu3ve
2025-08-10T13:39:59.581Z ERROR [Better Auth]: INTERNAL_SERVER_ERROR Error: Failed query: select "id", "expires_at", "token", "created_at", "updated_at", "ip_address", "user_agent", "user_id", "impersonated_by" from "session" where "session"."token" = $1
params: 7lIiWUkRjrVmOh4UJ0rZgjrvITaKu3ve
...

Have I been pwned?

When we use the have I been pwned plugin, on signin if we try to login with an account that doesnt exsist with a compromised password. It says change the password as its compromised, but in relaity the compromised check should only check on signup and login message shouldnt be this

NestJS Prisma MongoDB - Model ${model} does not exist in the database

app.module ``` import { Module } from '@nestjs/common'; import { AppController } from './app.controller'; import { AppService } from './app.service';...

Exposing FetchOptions Type with Better-Auth?

It seems that if I want the type definition of FetchOptions. I need to install @better-fetch/fetch
import type { BetterFetchOption } from '@better-fetch/fetch'
import type { BetterFetchOption } from '@better-fetch/fetch'
...

Anyway to support shared emails when using the username plugin?

Using BA for a game where players tend to make a lot of accounts and use a shared email between the accounts, BA currently does not allow this and was wondering if any work arounds?

Want help to use rate limiting for a custom Route : /api/form

I’m building a simple form with no login or signup. I want to add rate limiting to one specific API route, but I’m stuck. I read the docs, but it’s not working. Can someone help me set up rate limiting for that route?

client_credentials flow for m2m auth?

Howdy! I'm enjoying using this library a lot! I'm hoping to use it to throw a POC together. I see in the OIDC provider docs that Client Credentials is supported. But, when I make the following req to my auth api: ```bash...

ios 26 expo google auth

currently have a weird bug where when i bring up the sheet for auth, the sheet is blurred.
No description

expoClient type error in monorepo when used outside of expo app

I have a turborepo with package folder named auth which has better-auth setup to import into my expo and next.js apps. ```js // mobile-auth-client.ts import { createAuthClient } from "better-auth/react";...
No description

YOU_CAN_ONLY_SEND_A_VERIFICATION_EMAIL_TO_AN_UNVERIFIED_EMAIL

I have a custom signup logic , when a user try to login i am sending a verification email from front end using this code ```ts await authClient.sendVerificationEmail({ email: "user@email.com", callbackURL: "/" // The redirect URL after verification...

Why getSession (and customSession) don't include additionalFields?

@Better Auth I dived deep into additionalFields, customSession and related concepts. This isn't about using infers for types, that works well for both server and client side. It seems like even though adding additionalFields, even with returned: true (which is documented as: If the value should be returned on a response body.) it isn't returned to the client when the client calls getSession... ...

Registering Passkey returns empty res

When registering a new passkey, the data & erorr are undefined.

better auth organization plugin vs ABAC

i just came across BA's org plugin, so i just skimmed it for now cause it's pretty dense i usually just use CASL for ABAC, so i was wondering if that's something the plugin replaces/is better at, or if there are some things it has yet to do like CASL does thanks...

Disable OTP signup does not return error

I disabled otp signup for my app and I expected to receive an error while user who is not registered try to sign in using OTP. but currently it diables the user creation that is true, but how I will show an error in the login page that this email is not registered

How do we update custom session data without a full page reload?

In my Better Auth Next.js apps, I rely heavily on the custom session plugin to load user-specific data, keeping server and client in sync. However, I'm struggling with how to update this session data without a full page reload, as I want to avoid resetting client state unnecessarily. authClient.useSession() doesn’t seem to support live updates to custom session data. Right now, I copy that data into a custom context and manage updates there, but that forces me to use my own context for auth acro...

Typescript not seeing role as a valid attribute

I'm trying to check if a user is admin in order to access admin only pages. To do this I have this code, it works fine. ```js const session = await auth.api.getSession({...

Nestjs Prisma

Hey. Im using nestjs with prisma adapter, but im getting a server error when i try signing up with oauth github. SERVER_ERROR: TypeError: Cannot read properties of undefined (reading 'verfication'). i added to screenshots, one is my better auth config and the other is prisma client init.
No description

SERVER_ERROR: error: relation "ssoProvider" does not exist [ExpressJS and NextJS]

Hello, I'm currently struggling to get the SSO working because of "bad" integration with postgreSQL i assume? Every postgresql table needs to have a schema. My API is connected to a specific schema, but even publishing this table in all schemas it does not work. ...