Better Auth

BA

Better Auth

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

Join

bug-reports

help

Cannot create organization after adding additional fields.

With the recent update we can add additional fields, but it is not allowing me to create new organizations. I know this cos I removed the additional fields and it worked. I got invalid parameters error. Can I get help with it

`callbackURL` for `emailVerification` using `sendOnSignUp: true`

How do I change the callbackURL for the email verification if my sendOnSignUp is true? It seems I can set it if I manually trigger the verification email: ```...
No description

Leave Organization

https://www.better-auth.com/docs/concepts/hooks Hi everyone, I'm currently integrating BetterAuth and have run into a challenge related to the "Leave Organization" functionality....
No description

logger not working

auth.ts ```ts export const auth = betterAuth({ database: drizzleAdapter(db, { provider: "pg",...

/api/auth/callback hangs after switching to `linker=isolated`

hi all, currently in js ecosystem hell after trying to use bun's linker=isolated to get the expo + nextjs projects in my monorepo on different react versions. anyone ever see an issue like this before? it seems completely random and i havent touched anything better auth related

TypeScript error with sveltekitCookies after updating to v1.3.4

Hey everyone! đź‘‹ I'm experiencing a TypeScript error with the sveltekitCookies plugin, which seems like a regression after updating to the latest versions. I'm getting a type mismatch error when using sveltekitCookies(getRequestEvent): ```...

Auth.js comparison - Edge runtimes, JWT sessions, and scaling.

I stumbled upon better-auth while nearing completion of my auth.js integration. After perusing the docs and forums, I understand why better-auth is praised for it's ease of setup and community support (and confirm those as pain points with auth.js) . I could abandon my auth.js integration and work towards integrating better-auth, but I do see a missing feature that gives me pause. From both the docs and posts I've found on the topic, it's not clear that better-auth has a good answer to Auth.js's edge compatibility? Specifically, Auth.js provides three strategies for you to store/fetch sessions and user data: ...

CAPTCHA plugin — does it run on server-side API calls?

Hey everyone! Does the captcha() plugin still run when using auth.api.signInEmail() (server-side) instead of authClient.signIn.email() on the client? When I call from a +page.server.ts form action (server-side), it doesn’t seem like the CAPTCHA plugin is being enforced....

Send and Receive Custom State in Authorization Flow

Is there a way to send and receive custom state to the authorization flow. I am building a app, where users can login but they can also authorize other accounts for google api access (but not used for login). I want to be able to maintain 2 different types of "accounts" which i can then use to determine when a user can log in or not

how to properly setup for cross domain - express + vite react

Cookie “better-auth.session_token” has been rejected because it is in a cross-site context and its “SameSite” is “Lax” or “Strict”.
Cookie “better-auth.session_token” has been rejected because it is in a cross-site context and its “SameSite” is “Lax” or “Strict”.
despite adding the required config in my backend auth.ts i am facing this issue. one thing is i am using http can it be the reason, if yes why am i getting the error above Instead of new error?...
No description

How to handle multi-user authentication

In my app, I have many types of users, like: student, teacher and more

Using custom API for auth

I have an API that handles users creation and password verification, I want to use better-auth for session managment

Organization Teams Permissions

Hi everyone! I'm using (and loving!) Better Auth on a platform that uses the organization plugin for which, I have enabled the Teams options as well. I would like to manage permissions based on organization roles. But at the same time, I would like to do something like this: - Roles (resources->actions) for specific teams. ...

Sign up a user that already exists

I'm trying to create a flow where a "guest" has filled out am appointment form but hasn't created an account. I am saving their details in the user table (email and name). What's the best way of transforming the "guest" user to a fully fledged account when they sign up? It would be nice if I can sign the user up, but keep the same user entity since I'm using it to link to other tables to keep track of what they've booked....

Custom fields with Magic Links/Social Sign Up

I have a custom field referredBy with my user, which stores the referral code they used to sign up. With email/password signup, I use it as follows: ```typescript authClient.signUp.email( { email: data.username,...

getSession does not work when baseURL is set

This baseURL in the context is now needed because of a breaking change that I updated into https://github.com/better-auth/better-auth/blob/a066293b35221aafd5b1ce5c814805bc9d816aa0/packages/better-auth/src/plugins/magic-link/index.ts#L192 Do mind that im doing a server-only approach for better-auth...

Setting up additional fields in organization plugin.

I want to know how to set up additional fields in organization. Am using react vite as client and express.js as server. I want to know how to set it up and also update the organization with the fields added. What I tried always gives 500 error invalid parameters or something

session data is null despite session cookie

so i have a hono api and i've writtten a custom middlware to check for authentication which works fine locally however, in prod (deployed on cf workers) despite the headers containing the session cookie the session is null, here's my middleware: https://github.com/777advait/better-auth-monorepo/blob/main/apps/api/src/middlewares/authenticated.ts server logs: ``` GET https://better-api.astro-dev.tech/api/auth/me - Ok @ 7/27/2025, 11:07:06 PM...
Solution:
i fixed it! it was a cloudflare issue, i was instantiating an auth instance in my api app, and the base URL of that was a worker, workers dont allow communication among each other over public network, the requests fail silently (no messages no warnings), it can only be permitted via service bindings https://developers.cloudflare.com/workers/configuration/routing/custom-domains/#worker-to-worker-communication https://developers.cloudflare.com/workers/runtime-apis/bindings/service-bindings/ i just moved my auth stuff into the api app so there's no worker-worker communication, everything sits in one place, it'd be good to be able to define custom fetch functions when instantiating auth instances in future...

Completely different user flows

What would be the recommended approach for handling vastly different user types with better auth? I have, for example, students and teachers that have different requirements and sign up flows with many additional fields. Should I make two separate auth instances with their own db tables and routes or keep just one instance with roles and do table joins for other fields?...

auth/organization/list only lists 100 organizations -- is there a way to list all?

is there a way to list all organizations a user is a member of? it seems like by default there is a limit of 100