Better Auth

BA

Better Auth

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

Join

bug-reports

help

Reset password - Auth login.

Hello, is it possible to have the user login automatically when they change their password from the forgot password button. Currently I just have a redirect to the login page. Would be nice if it could be automated....

Sending additional custom fields on sign-up.

Is there a way to send some custom data in the authClient.signUp.email function. This additional data will not necessarily be stored in my database but is needed for some logic in the "user create after" database hook.

401 UNAUTHORIZED on SSO registration PingFed

Keep getting 401 unauthorized when trying to register sso using pingfed. Has anybody else run into this issue or has experience using Pingfed and Better-Auth?

better-auth/cli generate

Hi everyone, I'm having this problem with better-auth and Prisma. Below are the various files.

Using authClient in nextjs server components / actions

Hello everyone! I am working on a side project, and I have set up a turborepo monorepo with a hono backend and a nextjs frontend. I have set up better auth in hono, and the client library in nextjs, and I can successfuly communicate. However, I have found a note that we shouldn't call the authClient on the server. However, I was wondering if it was okay to call it on the server if we're using a separate backend? My reasoning for calling it on the server is to utilize the RSC an SSR. For instance, is this a safe thing to do on a route handler level in nextjs? ```...

Is it expected to have to set trustedOrigins to utilise SAML providers?

We are observing intermittent origin validation failures in our testing when using SAML, obviously this is fixed by including our SAML provider within our list of trusted origins. However, since this isn't outlined in the SSO plugin documentation, nor the Okta quickstart, we're wondering if we're just doing something wrong.

object as a user additional field

Hello everyone, I'm coding with svelte, sveltekit and mongoDB and trying to change my app log/sign with better-auth My issue is : I would like to add an object as additional field of a new user. However the type object doesnt exist yet so I can't do that. ...

HonoJS backend and NextJS frontend

@Better Auth I am having experiencing difficulty in setting up better-auth client for the frontend part. Can anybody please help with this

Attempted import error: 'useRef' is not exported from 'react' (imported as 'useRef').

@Better Auth Build Error with better-auth + Next.js 15 + React 19 Getting webpack errors when running next build: ...

Using jwt for changing passwords

We're trying to get jwts to work with our app, and while I can get the jwt to be generated and passed to the client. But I'm getting 401 Unauthorized when I'm trying to use it to make any operations, such as changing the password. The docs mention that I should use the Bearer plugin, which I did
This plugin is not meant as a replacement for the session. It's meant to be used for services that require JWT tokens. If you're looking to use JWT tokens for authentication, check out the Bearer Plugin....

Table schema prefix

Hello, I would like to change the prefix of each table, instead of public I should use myauth. What I should change? Thanks for any help

Better-auth dynamic products creation

Hi! Can you help me integrate the Polar plugin with Better-Auth? Instead of defining each product statically, I would like to allow administrators to add new products dynamically from my admin panel. Can you guide me on the correct way to implement this? I checked the documentation and found polarClient.products.list, but I’m running into type issues when trying to use it. Here’s the default code I want to modify:...

After new user creation hook when using magic link plugin

I'm looking for a way to replicate the "send a notification to your channel when a new user is registered" example from the hooks documentation but for the magic link plugin. I see that I could instead hook into requests for the /magic-link/verify path, but there doesn't seem to be any way to distinguish successful verifications which result in a new user being created, versus those which don't. https://www.better-auth.com/docs/concepts/hooks#example-send-a-notification-to-your-channel-when-a-new-user-is-registered...

2FA support for passwordless sign-in

Is it possible to use the 2FA plugin with passwordless sign-in methods like OTP/signin with provider? I don't see a clear way around the password requirement when enabling 2FA. Is this solved / does anyone know of a clean workaround for this?...

Slack Auth approved based login system

I'm trying to query my database when a user logs in with slack and I can't figure out how get it to work. I've tried the onSignIn callback and that doesn't seem to be called with the slack auth. database hooks don't do everything i want to do with my login. What i want to do is create a user in the database using the slack return data and display a message saying that the user needs to be authorized by an admin to login. I also want to check to see if the user is disabled, deleted, ect.. how would i do this with slack auth using nextjs?...

createAuthMiddleware context.returned

i want to check user role on createAuthMiddleware hook, but returned only return basic user field like id, name, email, emailVerified, image, create and update at. no role field, how to fix this ```ts hooks: { after: createAuthMiddleware(async ({ path, headers, context }) => {...

🆘 Need help with Better Auth + Express + MongoDB (Session always null)

Hey everyone 👋 I'm using Better Auth with Express, TypeScript, and MongoDB. I've set up authentication as per the docs — login works fine and I can see the session being created in my database. ...

Implementing Silent SSO/iFrame Authentication with Custom OIDC Provider in HonoJs/better-auth

I'm building a HonoJs API using better-auth. This API is consumed by a set of small, independent web components that are embedded on various external, top-level domains. The Challenge & Constraint: I cannot rely on traditional cross-site cookies for session management in the embedded web components....

After upgrading from 1.2.12 to 1.3.28, expo doesn't persists session in SecureStorage anymore.

So, i updated my dependencies (@better-auth/expo, better-auth) to 1.3.28 and now it doesn't persist the session anymore. I have a very simple authClient, see: ```typescript import { expoClient } from "@better-auth/expo/client"; import { createAuthClient } from "better-auth/react";...

INVALID_OAUTH_CONFIGURATION in Sveltekit

Hello, I have this configuration ```ts import { betterAuth } from 'better-auth'; import { drizzleAdapter } from 'better-auth/adapters/drizzle';...