Better Auth

BA

Better Auth

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

Join

bug-reports

help

migrating from supabase auth how are passwords handled?

Hi, I'm using supabase auth currently and I'm wondering how the passwords are handled when migrating as supabase uses bcrypt to hash passwords but I believe better-auth uses scrypt? So how does that work? Do I need to support both bcrypt + scrypt such that when users login I'll need to check both bcrypt and scrypt and overtime only support scrypt once all (or most) users have signed in again?

How to set username on OAuth signup?

I have disableImplicitSignUp enabled and want users to choose a username before signing up with OAuth. Here’s the flow I’m aiming for: 1. User clicks "Sign in with Google" 2. A dialog appears before redirecting to Google, asking for:...

implementing advanced 2 layer RBAC

i have a more advanced usecase for the access plugin yes, im using the organization plugin too i want to have a role per organization and each organization will have many projects and i want a user to also have a role per project...

rate limit error returns status code 401 instead of 429

```ts error [Error [APIError]: Rate limit exceeded.] { status: 'UNAUTHORIZED', body: [Object], headers: {},...

error signing in with box

I'm trying to sign in with box , but facing some unusual issue shown in the image here's my code ```...
No description

How can I check Google Social if it is SignUp or SignIn?

I have different callbackURL for SignUp and SignIn. I can do it for normal email signIn and signUp, but cannot check if it is signUp or signIn for all sso sign-in/up. Is there any way to check if it is SignUp or SignIn? Thanks.
Solution:
You should be able to provide a newUserCallbackURL in the signIn.social method

I'm trying to seed a user into the database during my setup process

Is there a way to seed a user directly into the database using Better Auth without relying on the request context(cookies)? `const superAdminResult = await auth.api.signUpEmail({ body: { email: "admin@example.com",...

How to grab `set-jwt-token` on sign-in?

When signing in via email/password, I am trying to create a middleware afterHook to grab the set-jwt-token but id but it doesn't seem to exist at that point?

emailotp also sends to a non-existent user

The emailotp plugin also sends otp to unregistered users and tries to register even though disableSignup is true, am I doing something wrong?
No description

verifyPassword failed

Hi, I am using better-auth with supabase, everything working fine (migration, seed). but when i am trying to login i am getting this error

Expo web doesn't retrieve the token

Hello 👋 I'm trying to use better-auth with expo on the web part. It is working great on the native part, but when trying to sign-in on the web part, it seems that the token is not retrieved. ...
Solution:
I have finally succeed to make it works. To complete what I have found, I think on the web the set-cookie from the response header should be enough to store the cookie, this is why the "setItem" is skipped on the web. But this should be documented IMO. ...

[Hono] sendVerificationEmail: url does not include host/any paths until /verify-email

I am using hono to build an API and to send a custom email for verification (with resend). when I configure the better auth instance, this is my code ```ts // … emailVerification: {...

Lichess.org PKCE gives oauth_code_verification_failed

Can you help me debug this issue? I'm trying to link an account to lichess.org via OAuth with PKCE using a genericOAuth provider but I keep getting this error oauth_code_verification_failed on better-auth. SETUP...
No description

Hono + Better Auth NOT_FOUND Error on Auth Endpoints (e.g., /api/auth/sign-up)

Hey everyone, I'm setting up an authentication API using Hono.js, Better Auth, and Prisma with PostgreSQL. I've followed the recommended setup and folder structure. My Hono app mounts the authRouter (which handles Better Auth's auth.handler) at /api. So, endpoints like registration are accessed at /api/auth/sign-up....

ElysiaJS setup fail

I've tried betterAuth twice and always give up as I fail to get it working. I'm using Prisma ORM and just email and password for now, I've set up the betterAuth middleware (mount and macro) and added the catchAll routes under /auth/* Debugging shows me that the routes are being intercepted by betterAuth but nothing other than that happens, Generating the schema throws some long error I don't understand....

Failing to create user

is there a way to debug this error I'm getting while creating a new user: { "code": "FAILED_TO_CREATE_USER", "message": "Failed to create user",...

Google LinkSocial Additional Scopes

Hello! I am using Google Oauth as a provider and attempting to follow the documentation to allow users to add calendar scopes after the login, the below correctly adds scopes, but once a user logs in with the standard oauth again that overwrites the additional scopes. I've been trying to debug this for a bit but can't figure out if there is supposed to be standard better-auth management for this or if I need to add some hook to the database to make sure we don't overwrite the scopes. Tahnk you! ```{typescript}...

Authenticate /pages/api route

Hi, i am trying to protect my websocket connections by verifying if the user/client is logged in or not. Usually i'd use the getCurrentUser function: ```ts "use server"; import { auth } from "@/lib/auth";...

How to figure out if subscription is canceled on trial

One confusing aspect of subscription object is when a trial is canceled, it only shows trialing state rather than cancelled-trial or similar status which makes it hard to show a cancel or resume button since I don't know if user canceled their trial or not.