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 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

Is there a way to set the session cookie on verify OTT?

I'm using the OTT plugin to embed the token in a QR link so users can easily open a link in their phone but I'd like to keep them signed in after that. As far as I can see, verifyToken doesn't set the session cookie. Is there a clean way to do this? I guess I can try to set the cookie myself, but I'd prefer if there's a clean way supported by better auth itself

Better Auth with T3 Stack and Middleware not working

Hey i'm using T3 stack and trying to implement better auth to it. I'm having problems with my middleware, as it seems that it does not do anything. middleware.ts: ```ts import { NextRequest, NextResponse } from "next/server";...

⨯ TypeError: Cannot read properties of undefined (reading 'bind')

hi! Can someone please help me with this issue: ⨯ TypeError: Cannot read properties of undefined (reading 'bind') at h (.next/server/chunks/999.js:1:8478) at l (.next/server/chunks/999.js:1:8118)...

Polar Plugin (accesing portal error)

Hi so i've been updating my better auth version and plugins, i was using v1.2.5 and now 1.2.12 and now using newest version of polar plugin (1.0.3 and was previously on 0.0.9) So before i used to redirect from the frontend to my backend using router.push redirecting to backend_url/api/auth/portal Now looks like it changed to /api/auth/customer/portal...
No description

Can't generate JWKS using 'ES256'

I want to create Postgraphile Schema using createPostGraphileSchema and pass the private key for JWToken verification. However this does not support better's auth default encyption algorithm. Allowed ones according to their comment in interface SignOptions: ``` /**...
Solution:
I think this is a bug. Made a pull request...

Is there any way to track DAU natively?

Is there any native way to track or get the Daily active users from betterauth ?

Help with the polar plugin

Hi guys so I'm trying to integrate org based subscriptions/payments in my app with the better-auth x polar plugin, looking for advice on how to go about it if anyone has attempted this