Better Auth

BA

Better Auth

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

Join

bug-reports

help

Auth config for the client side visualization

Is there any way to get auth config via any endpoint, which can be used in the front-end for visualization, means if emailAndPassword is enabled, what are the social login available, what are the plugins available, based on these details, we can customize the signin UI.

'useRef' is not exported from 'react'

Hi, on my NEXTJS website I try to install better auth and I have this error that I can't solve
No description

would it break anything if i manually create users?

I am wondering if it would break better-auth in any way should I manually create users via drizzle -- for example, if I want to add "guests" that can't sign in or do anything else, but have a record in the users table so that other table schemas can have a nice foreign key ref.

Hashing E-Mails

Does anyone have experience with writing and reading emails as hash from the dabase using oAuth and Magic-Link as authentication options? I tried some approaches using databaseHooks for storing the email as hash and Better Auths hooks for finding the hased email in the database but i just cant seem to get it to work.

New to better-auth

Hey folks, since better-auth generates own tables, can i modify that? I want it to be linked to my own users table, would that do anything bad?

how to list user organizations on server side?

i only found the authClient.useListOrganizations() but how would i go about getting that on server side?

Auth failure

Hi guys i have two separate apps a nextjs and a honojs backend both using better-auth for some reason i cant make a login request it just returns the following error ...

Email Verification Callback after Email Change

When you change the email of a verified user, and provide a callback url, an email is sent to their current email to confirm the change with that callback, but then another email is sent to the new email to mark their new email as verified, but what will the callback url for that email be? How can we customise it?

No session available immediately after successful passkey verification

I am trying to implement passkey authentication. When I have a successful response from /api/auth/passkey/verify-authentication I use the NextJS router to navigate from /login to / I also have middleware.ts checking for sessions, and redirecting to /login if there is no current session....

Azure Static Web Apps Authorization

Hi everyone, I have a preview environment on azure for both frontend and backend. The backend deployed on azure container apps and the frontend on azure static web apps (The front and the back are separated repos thus the separation). ...

MagicLink working in localhost but not in prod

I'm using Next.Js, Coolify for production. This is the server action use to send the magiclink : ```...
Solution:
use auth.api on the server side. @mrk

want to use better-auth for a project and write it in backend, can't write. help...

Guys i an unable to configure better-auth for my project in the backend guys help.(attached image how it looks now)
No description

phone + password (no OTP)?

hey guys, i was in the middle of migrating from supabase auth to better-auth when i hit a snag. basically i want to allow a single admin user of an orgazniation to create users with phone and password. then said users can sign in with phone and password, without OTP . I am thinking we will only use OTP for forgot password flows, but since this is a business app, probably just put the onus on the admin to reset forgotten passwords in app....

Can't call `await getJwtToken(ctx)` on new session?

Trying to generate a JWT after the user signs in via email/pass. Current code is: ```ts if (ctx.path.indexOf('/sign-in/email') !== -1) {...

Cannot read properties of undefined (reading 'accountId')

I can't seem to figure out what this issue is. Steps: 1. Create new account with Google social provider 2. Sign out of the account and refresh...

Microsoft Entra ID App Roles & Better-Auth

Thank you for the tool. My tool/framework stack is the following: - SvelteKit - Drizzle-ORM...

How do best do custom database migrations

I'd like to build a custom Database adapter for a database that can handle programatic schema changes, but not via standard SQL syntax. What I'd like to do to expand upon the existing generate or migrate commands from the Better Auth CLI, since it already handles loading the user's config, but these functions are not exported from the CLI package for me to use in my own CLI. What is the best way to approach this? I would also be OK with exposing a method on my adapter that simply handles the mig...

How to handle multi-tenant

@bekacru @Ping I am currently running better-auth at domain.com this is the place where users can create their own example.domain.com and manage their domain, so I authenticate them (email/pass, google and github) and I use better-auth for that (so my BASE_URL of better auth is: domain.com). so I need to authenticate the visitors of my user's site, separately and store them in separate collection (like subscribers). so example1.domain.com subscriber is not the same as example2.domain.com subscriber and they will be stored in subscriber collection....
Solution:
i ended up creating another instance and it worked not sure it is the best way.

Stripe Plugin Bug on Customer ID?

Hi I'm using the stripe plugin in my app. I noticed when testing if a previous bug was solved (it is), that everytime i open / create a checkout, i get a new customer id. I have this code on my frontend when clicking on a "subscribe" button (photo 1) Webhook in test mode (photo 2)...
No description