Better Auth

BA

Better Auth

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

Join

bug-reports

help

Hook into Post oauth login flow

How can I hook into the flow before better Auth creates the user and check, if the discord id ia regestres, if yes and there is no User then create it. Thanks!

Stripe Subscription Update Shows Error in Console but Still Works

When creating a Stripe subscription, an error is thrown in the console, but the update is successfully reflected in the database. The prisma model is automatically generated by the* better-auth* CLI.
Solution:
The issue was resolved after updating the API version. Thank you for your prompt and helpful response.
No description

Fixed OTP for phone number sign in

Hey. Is it possible to set a fixed OTP for a specific phone number? I need this for the apple app store review to be able to sign in.
Solution:
Sorry for being unclear. i mean fixed as being constant, but solved it. Just updated the verification record after sending the otp

Lambda Authorizer with Better-Auth

Did anyone try this integration yet? I intend to have better-auth authenticate the requests coming in AWS Gateway

What is the "token" returned by auth.api.signinEmail?

Hello, I use a custom endpoint for sign-in/email. The return of auth.api.signinEmail() is:...
Solution:
you most likely don't need to return it but it's safe to return

session object on databasehook

```ts session: { additionalFields: { isCompletedOnboarding: { type: "boolean",...

couldnt find organization.listInvitations

https://www.better-auth.com/docs/plugins/organization#list-invitations I couldnt find a function const invitationsR = await authClient.organization.listInvitations({...
Solution:
update to latest

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: 'whatever@example.org' } 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...