Better Auth

BA

Better Auth

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

Join

bug-reports

help

redirect after sign up, emailAndPassword

``` await signIn.email( { email, password, callbackURL: "/admin",...

Extending organization.create

Hey guys I'm trying to add something simple when creating an organization and was wondering if there was a way to do something like this ```typescript const response = await organization.create({ name: data.name,...

Middleware in a Better Auth Project

how the middleware of a project using better-auth should look? because i was using this middleware: ```tsx...
Solution:
We highly suggest using the middleware in next just to decide routing for a user and not the only place to check for auth. And fetching session from an api can make your site slow, since now you're running a server and a db on every call. I suggest checking for cookie and on the actual pages, checking for the actual session.

Create organization after singUp

I want to create Vercel like onboarding experience. What is the best way to create personal organization right after signup? I thought about using databaseHook after user creation but I can't make it work.

rbac / orgs / permissions

Hey guys, First off thanks for developing and maintaining this and congrats! Very nice. I'm new to auth systems and app development and need to confirm if your solution supports my specific multi-tenant app requirements for my app....
Solution:
Hey for maning perms, you have 2 options built into better auth. App level access control and org level access control. For app level access control, check out the admin plugins and for org level the organization plugin has something built in.

Admin to add users to their organisation

Hi all. I'm building out a Saas project in next.js where I will have clients set up as organisations and each client will have multiple users. I've implemented admin and organisation plugins, have created some organisations and created some users which is all good. The lead user (as an admin) can create other users but how do these new users get assigned in to the organisation? I have basic RBAC established so that only an organisations users can see data/ other users in that organisation.

Session type after using admin

Hello everyone, I just implemented admin plugin for role-based authorization Then I changed user's role type to enum How can I also make this change to session type return from useSession? By customizing session?...

Anyone have an idea what this bug is about

The inferred type of authClient cannot be named without a reference to ../../../../node_modules/better-auth/dist/shared/better-auth.Bi8FQwDD . This is likely not portable. A type annotation is necessary. I have added dom to tsconfig, cleared my node_modules and cache, updated to better-auth: ^1.2.4, as well. This is what I am trying to do, example from docs...

Tanstack Start Server functions cookie issue

Hi, I'm having trouble getting session_data cache cookie to update when I use the auth api inside a tanstack start Server function. It is similar to next.js I think, and I have recreated a version of the nextCookies() plugin for tanstack start. problem is it works perfectly in development server, but not in vercel/netlify deployment. can anyone confirm if they have the same issue or help? thanks!...
No description

Single Auth Multiple apps setup.

Hi. I am trying to setup a central auth which will be used by multiple apps. I tried creating OIDC but its not working good for me. I came across this comment. How should we go about this. I have nextjs central auth and tanstack start first client app. Do i need auth.ts in tanstack server api routes or only in nextjs central....
No description

How can I extend the organisation plugin?

I need organizations for my tool that have teams, where I can select the active team. It should behave similarly to how it works with the organization, but within the organization.

[# Drizzle Adapter]: The model "team" was not found in the schema object. Please pass the schema dir

Trying to active the teams on organization, already did a migration, but still not able to add it.

Better Auth errors with state not found after social sign in

Any idea what could this specifically mean? after a signin with social provider(github) it would rediret me to the error page with the state_not_found error

.cursor/rule For Better-Auth

Hello, is there a cursor rule for better auth docs?

Betterauth CLI Fails on sqlite

https://www.better-auth.com/docs/adapters/sqlite After following guide from docs, Cannot generate using see error messages....

Next Auth `iss` claim missing

Hi, I'm not sure whether to ask this in Next Auth/Auth.js server or here, but I assume here because the same Next Auth config works for other OIDC providers without modification. When attempting to sign in with Better Auth + OIDC plugin, I receive this error from Next Auth: OperationProcessingError: JWT "iss" (issuer) claim missing. Attached screenshot of supported claims from well-known endpoint on BA side, as you can see iss is listed, which makes me think BA is not the problem. Any ideas? If this is a Next Auth error after all, I'm confused why it works for other OIDC providers EDIT: also asked in Auth.js server and linked back here: https://discord.com/channels/1200116961590399008/1354958631476531220/1354958631476531220...
No description

Machine authentication (Client Credential Grant)

I'm wondering if its possible to use better auth for machine auth(Client Credential Grant). I have a another app that needs to send data to my app, for this it needs to authenticate. What would be the best way to do this? I was not able to find this in the docs....

Stripe sync subscriptions

How can I sync subscriptions which got created with stripe dashbaord that I have that subscription in my database as well? I using the stripe plugin so far...