Better Auth

BA

Better Auth

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

Join

bug-reports

help

Removing name from user table

I don't want to have the name in user table I want to replace it with firstName and lastName how can I do ?

getting user info on server side

I'm using nextjs for my frontend and expressjs for my backend. How can I get the user info on nextjs server (in my middleware) since the auth server config is on my expressjs backend

ERR_REQUIRE_ESM on better-auth 1.2.10 (not 1.2.11+) on Vercel Deployment

Hi ! First, thanks a lot for all the efforts put in the library, it's really a time saver for me 🙂 I'm having exactly the same error as here (https://github.com/better-auth/better-auth/issues/3260) when deploying the project on Vercel (it doesn't trigger on a local build). I enforced a 1.2.10 version of better-auth to fix the problem but it still pops up. It does also happen when trying to bootstrap a blank Payload CMS project with npx create-payload-app@latest....

creating an organization with teams enabled is failing

when I try creating an organizastion the members is not being auto-created nor is it actually even working Also, 2nd image is when teams.defaultTeam is enabled...
No description

Drizzle TypeError: not enough arguments

i just started my instance today and all of a sudden fails to boot complaining about mysql key not provided. ive been using sqlite with drizzle all this time database: drizzleAdapter(dbClient, { provider: 'sqlite', schema: schema,...

Can't get someone elses github project to work

Im trying to start https://github.com/outpoot/rugplay yesterday everything was working suddenly not anymore i can't seem to find what the problem is using https://192.168.178.223:5173/...

Is there a way to add more infromation on sign-up?

I'm trying to add a new field in the user signup aside from the defaults. I wanted to add a field like invitedBy on the client, something like this: ```await authClient.signUp.email({ name:, email:,...

Handling auth on server-side?

I'm using React Router v7 (Remix), and I want to authenticate on the server. But it seems like BE doesn't support server-side auth. Is this really so?
Solution:

Email OTP

Hello, is it possible to also provide name, password, image on a signup OTP similar to email signup?...

Using the auth object on server side Nextjs

Hey BetterAuth community 👋 — I’ve got a quick question (and possibly a suggestion) regarding how to properly use the SDK on the backend. I'm trying to update an organization from a Next.js API route, specifically from a webhook handler for Polar (a payment provider). I noticed there’s a auth.api.updateOrganization method available on the server-side auth object, but its usage is a bit unclear in a backend-only context. It seems to require headers like 'Content-Type': 'application/json', but since I'm not making an external API call (just referencing the SDK on the server), it feels a bit awkward. Here's what I currently have:...

getSession called in next middleware reports: PrismaClient is unable to run in this browser envir..

The full error message is : [Better Auth]: INTERNAL_SERVER_ERROR Error: PrismaClient is unable to run in this browser environment, or has been bundled for the browser (running in ``). Looks like better-auth is trying to call prisma in the next Edge environment which it shouldn't. Anybody seen that before ?...

Google OneTap when the app is on dark mode contains a white background

I'm using Next.js and Shadcn UI and Google OneTap, with better-auth. When the app is in light mode, the Google OneTap popup is white and looks fine but when the app is in dark mode it is automatically set to dark mode (that's fine) but there remains a white background around the popup. Can anyone help me out? I have no specific stylings for the popup.
No description

noobie question whats the better auth secret used for? is it just managing sessions?

cuz for security reasons i dont want to forever use the same key in my app so id ideally want to be able to rotate it every now and then, but then the other question, if its only used for sessions, would changing it force logout all users? if so, could i gradually do it over time and insert an array of old secret and new secret and slowly transition to the new one?...

How to insert timestamp in lastLogin for social login like google

```js const signInWithGoogle = async () => { try { await authClient.signIn.social({ provider: "google",...

Update/Fetch tables with custom fields

Hi! I’m using Better Auth in a multi-tenant SaaS app. I have a Member table, given by organisation plugin (separate from the core user table) that stores organization-specific fields for each user (like company email, designation, etc.). I noticed that Better Auth’s APIs (like getActiveMember) only return the fields it knows about, and do not include any custom fields I’ve added to my Member table. I want to be able to fetch and update these custom fields through Better Auth, or at least have a recommended way to do this. Is there any built-in way in Better Auth to fetch and update custom fields from custom tables (like Member), or do I have to create my own backend endpoints for this? ...

Getting a very strange issue with apple sign in using web client

✘ [ERROR] # SERVER_ERROR: TypeError: Key for the RS256 algorithm must be one of type CryptoKey, KeyObject, or JSON Web Key. Received an instance of CryptoKey
✘ [ERROR] # SERVER_ERROR: TypeError: Key for the RS256 algorithm must be one of type CryptoKey, KeyObject, or JSON Web Key. Received an instance of CryptoKey

Can't pass token_access_type to dropbox provider? No way to get refresh token?

Hi! Probably newbie err, but it appears that the dropbox social provider doesn't support setting token_access_type=offline, nor does it seem to honor authorizationURLParams in the options. Alas, together, these perhaps make it impossible to request a refresh_token? I've tried working around this by making my own dropbox provider using the genericOAuth base, but that has it's own problems (I think there's a problem with dropbox's pkce config which breaks using genericOAuth). So I'm kind of stuck 😦...

resetPassword & emailVerified

When resetPassword is successful, emailVerified should be turned to true also, no ?!

resetPassword & autoSignIn

I can see in the doc that autoSignIn is for "after sign up". But could we have a flag for autoSignInAfterResetPassword ?...

emailAndPassword sign-up error in Nodejs-Express

- The user was added to the DB, but the api responded with error [500]. - [Better Auth] ERROR The field "expiresAt" does not exist in the "account" schema. - Session was not created after sign-up The schema was generated with the CLI and No "expiresAt" on the account table....
No description