Better Auth

BA

Better Auth

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

Join

bug-reports

help

how to use kysylo-adapter with better-auth

i want to write t3-app with kysylo and better-auth. but i found i can't use kysylo-adapter.

[OIDC] federated logout (`end_session_endpoint`)

Does BA implement the OIDC standard end_session_endpoint in the OIDC provider plugin for federated (RP-initiated) logout use cases? Section 2 "RP-Initiated Logout" in the spec here: https://openid.net/specs/openid-connect-rpinitiated-1_0.html...

Better Auth with Capacitor

Hi everyone, I’ve set up a backend using Hono and BetterAuth. My frontend is a ReactJS project with Capacitor. I’ve also installed BetterAuth on my frontend to use client functions for logging in and other things. Everything works fine when I use a regular browser, but when I build the app natively with Capacitor, the token isn’t stored. Do you have any tips or can you provide an example somewhere?

Multiple accounts with the same e-mail

I would like users be able to have multiple accounts with the same email but with different providers. Eg, 1 magic link account and 1 social (microsoft) account. They should not be linked together. Is this possible? I just get error account_not_linked when trying to log on with microsoft when a magic link account already exists...

Magic link verify on a secondary device

Is there a simple / built-in way to achieve where you can verify the log on attempt from a secondary device? Eg, if you want to log onto a tv where you cant receive emails. So you could just click the link on your phone instead and the tv would be the one logged on....

Account linking extra info

I have a question regarding account linking (using Google as the provider). Right now, I’m able to link an additional account with a different email address by using allowDifferentEmails: true. it seems like there’s no way to extend the account schema. I think it’s pretty common to have information like the name and email of a newly linked Google account, so that on the client side — when using authClient.listAccounts — I can display each account’s name, email, or other relevant info. I tried using the hooks and databaseHooks, but I couldn’t get it to work....

plugin schema: onDelete: "cascade" does not work?

Hi, I am creating my own plugin that creates groups within organizations. Part of my schema is this: ...

manage sessions in server

i want manage in server side in next js but docs not help? how can i manage sessions in servers

How to create headers on the server

Hey, our setup has a gateway in front and that one validated the jwt token I get back from the jwt plugin as passes forward the claims into a custom header. I now also want to provide some admin functionality but at the point where I am getting the request (via GraphQL), the session header is already gone and its unclear to me from the examples how I would f.e. call listOrganizations or listUsers on the server by passing in the user.id that I get back from the already validated token header. I could query the DB myself, but that kinda feels off...

what tables are a must for better auth to work

hello, i wonder to know why beter-auth uses so many tables and if they are optional i want to delete them specially session table which makes my db usage pretty high and costy. what do you say about this?

Is it a possible to use a relation table as type for fields in additionalFields ? (beginner 😅)

I'm currently working with better-auth and I’d like to access the pages field of the user directly from the session (code snippet below). (It's another table). Is it possible / a good idea to include this kind of data directly in the session (via customSession) or should I rather fetch it separately using a /me endpoint after login? I’m not an auth expert, so I’m not 100% sure what the best practice is here – any feedback or guidance would be super appreciated! 🙏...

server actions for users

I want to understand how I would setup a user.actions.ts file with better-auth. Could anyone please help me out understand?

Argument `stripeCustomerId` is missing.

I'm getting the following error: `` 2025-04-18T03:02:49.602Z ERROR [Better Auth]: PrismaClientValidationError: Invalid prisma.user.create()` invocation:...
Solution:
BA probably creates the stripe customer after the user is created in the database not before

Get user info

I'm using the admin plugin and I can list all the users in the DB using await authClient.admin.listUsers() but how can I get a single user info? I can't find a method like await authClient.admin.getUser(id).
Solution:
If you have the user id, you can directly query your DB using something like an ORM.

user admin type not updating

i added the admin plugin which adds the role column to users. how do i update the type so it doesnt give me errors?
Solution:
i just checed and realized i put the plugins in the wrong place mb
No description

Prisma + better-auth: schema type issue

I have been struggling with this issue for the last 3 hours. Keep looking into the why I am getting an error on type after running the generate command and making a push to my local PostgreSQL database. I have setup a simple form using ShadCN (they also use react-hook-form under the hood) and some other components such as the input field. Could anyone please help me out?...
No description

Better auth handler not working

Hey, I'm currently experiencing another problem with my better-auth instance combine with Hono. The better-auth handler is returning a 404 for the get-session url and I'm not sure why. The route is clearly hit as indicated by the logging but the internal handler returns a 404 for some reason
No description

How to acces ID token returned by oAuth provider

I'm using the Microsoft oAuth provider. It returns an ID token, which (when decoded) includes some user information I need to access, such as user group memberships. The ID token gets stored in the 'accounts' table, but I can't work out how to access it. I can't see any way using auth.api. I know I could query the database independently, but it seems like I shouldn't have to do that to access something that better-auth is storing....

Better-Auth with Express Server

I set up basic Better-Auth in an Express server with sqlite database. Followings the docs I have auth.js ``` import { betterAuth } from "better-auth"; import Database from "better-sqlite3";...

Property 'signIn' does not exist

```typescript import { createAuthClient } from "better-auth/react"; export const { signOut, useSession, signIn } = createAuthClient({ baseURL: process.env.BETTER_AUTH_URL!,...
Solution:
first make sure to config your auth correctly and to do the recomend of destructing the object since i dont exactly know your rules config for that but i recomend this way and also the safest way ```ts const authClient = createAuthClient({ baseURL: process.env.BETTER_AUTH_URL!, });...