Better Auth

BA

Better Auth

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

Join

bug-reports

help

Backend Solution Better-Auth Integration

Just want to know if anyone has tried to work with better-auth with a full-backend solution (i.e. not having any client-side SDK implementation)?

How to set a password if we are logged in via a provider?

I am trying to create an account management system, but changePassword requires the current password. but i logged in through google. how do I properly handle this senerio? I want to user to be able to set a password if they haven't already.

Handling error of forgetPassword call

Hi, I'm trying to handle the error when using forgetPassword but if I provide an email which is unknown, I can't catch the error. I'm seing this in the output: 2025-04-13T20:05:20.175Z ERROR [Better Auth]: Reset Password: User not found { email: '[email protected]' } Here is my code: ``` const handleResetRequest = async () => { setLoading(true);...

Provider invalid OAuth2 redirect_uri

I am getting an error when I try to sign in with Discord on my prod environment. I don't have this issue locally I get Invalid OAuth2 redirect_uri and I checked the browser logs ``` GET...
No description

Adding custom properties to Organization members

Hey, The title says it all 😛 I would like to add custom properties to the members of an organization but I don't see any docs on it. I tried adding it to the table and hope the auth.api.getActiveMember() will pick it up but no luck 😦 ...

organization type error.

is the documentation outdated? for this?
No description

Custom Tables | SQL Schema

:nuxt: Help me understand how Better-Auth works with the DB. Better-Auth has its required core schema for the 4 core tables. For id uses string [I'm looking at the core schema] and the generated SQL gets a text type, for example. 1. If I create all tables on my own [Better-Auth Tables + other needed tables] and set that up at the DB level, does the auth instance still need to know about all of them, i.e. via me configuring the better-auth object [for a custom field I added on the user table] and creating my own plugin [for the extra tables]?...

RefressAcceshToken in SocialProvider (Microsoft) and NextJs 15

Hey, i am struggling to trigger the refreshAccesstoken for Microsoft. Single Sign on works fine, i got an accesstoken and an accessTokenExpiresAt and a refreshtoken. But how do i trigger to refresh the accesstoken automatically refreshed in when it is expired. I thought, this is done automatically....

What would be the most secure and preforming way to use Better Auth with Next.js

I am building a Next.js project and I was wondering what would be the best way to use it with better auth. Q1. As the docs say there are two ways we can use any auth function either with authClient or auth. So if we are talking about security is it good to use authClient, I mean it would be easy to avoid validation if the things are happening on the client, If we use server actions with authServer we can do validation both sides Q2. If I am using server components or layouts files, should I use authServer or authClient. ( What I am currently doing is I am using authServer api and passing headers along. ...

auto-creating organization on user signup?

Has anyone managed to do this? Want to ensure users always have an org, i.e. a personal tenant even on signup. I did this through the UI but its pretty clunky. I tried this already: ``` databaseHooks: {...

Hanging timeout server-side requests using Cloudflare Hyperdrive

Anyone have success using Cloudflare Hyperdrive with Better-Auth? Basically, I have sign-in functionality server-side like: ``` const result = await auth(env).api.signInEmail({...

New Release Causes: `Field user_id not found in model member`

Hello, I updated from better auth 1.2.5 to 1.2.6 and now when I call the following: ```tsx const organizations = await Promise.try(() => auth.api.listOrganizations({ headers: request.headers,...

Does forwarding a JWT from a React SPA to C# .NET app make sense ?

I understand Better Auth is for TS codebases and it looks great. I want to keep my users managment in my db 🙂 I know nothing about C# .Net but I've been asked to build with 3 specific goals... 1) create a React SPA which handles the UI for users, profiles, payment, chat, etc...

Is there a way to get the refresh token after using a social provider?

I didn't find it in the docs but I was wondering if it was possible to get the refresh token from google after sign up. I need it for a calendar integration that I am building. If not is there a way I can handle the oauth2 callback myself so I can get it?
Solution:
pass accessType: "offline" in your google config

How can I get member with user in adapter

I'm trying to create a plugin that needs the listing of organization members. So I want it to get members and also users. ```ts listMembers: async (organizationId: string): Promise<Member[]> => { const members: Member[] = await adapter.findMany({ model: "member",...
Solution:
You can't using the current implementation of our adapter system. You'll need to use the adapter and fetch each user by user ID as well....
No description

guys, is it possible to do with better-aauth??

Guys, do you know if it's possible for me to do this? On the front end, log in with discord, any other provider, after logging in, send a request to the backend to set the user in the database, however, I wanted to send the jwt (I don't know if this is used in the cookie) to check whether or not the user is in the database after front-end signin --> back-end request to set the user to db, (do not set by front end)...

Error generating schema

So whenever I try to generate my schema (Using prisma)
npx @better-auth/cli@latest generate
npx @better-auth/cli@latest generate
I get the error in the image. I tried to generate the schema on a lot of my better-auth projects but in vain....
No description

How can I get other plugin's option in my plugin?

I'm building a plugin to extend organization plugin. I want to get organizationOptions so I can handle other stuff in the plugin. How can I achieve that? I tried
ctx.context.options.plugins?.find((plugin) => plugin.id === "organization")?.options
ctx.context.options.plugins?.find((plugin) => plugin.id === "organization")?.options
but that didn't work even though organization plugin is setup correctly......

cross-site cookie in express

I see past issues with cross domain cookies am not sure if a resolution was reached i've resorterd to disabing secure cookies to work around this ```ts advanced: {...

cookieCache doesn't work with customSession plugin

Hello. I'm wokring on a next.js 15.3 application and noticed that cookieCache doesn't work once I add customSession plugin. I enabled query logging for Prisma client, and see that it queries database on every getSession() call. Maybe I'm missing something obvious. Did anyone have similar issues? Here is my config: ```ts export const auth = betterAuth({ database: prismaAdapter(db, {...