send additional headers
is there a way to pass additional headers? Doing it like this throws an error and seems to completely override headers:
```ts
//client
await authClient.forgetPassword({
email: value.email,...
Vercel.app for previews
Hi,
I'm using BetterAuth in production across two different subdomains:
api.example.com
(where BetterAuth is hosted) and site.example.com
(I've configured cookiesubdomain
, etc.). Everything works perfectly in production, and I'm hosting with Vercel.
However, when I create new branches or run tests, Vercel assigns preview domains under .vercel.app
, and at that point authentication stops working....401 error Nextjs(cookies not being sent)
To Reproduce
Using express backend with drizzle
My apis arent being sent from frontend to backend, in nextjs, tried using with crenetials also
...
Refresh the page after authClient.signOut()
I have something like
```ts
const handleSingOut = async () => {
await authClient.signOut();
router.push("/login");...
extending user data from another table
we store our user's profile images in a "files" table with a join table "user_files". i'd like to override the default user "image" with the s3 key from the files table.
is this possible?...
Solution:
You can just set the s3 key to the
image
field once the img is uploaded to your Db right?Client side - get all permissions
Hey all, is there a way to get on the client side all of the resource permissions that the current user has?
Send additional data Google/Apple Signup
I want to send the onboarding data along with the signup for Google/Apple . How can I do this?
With email provider I can just use:
```typescript
signUp.email(...
Implemeting Notion OAuth2
Hey! I have tried everything now to implement the Oauth2 flow for Notion, but I always get this error. Anyone has any ideas what could cause it?

Stripe Plugin + AI Usage Limits - Anyone done this?
Hey everyone!
Is anyone here using the Stripe plugin for implementing AI feature limits in a next.js app? I'm looking to integrate subscription-based AI usage limits (like chat requests, token limits, etc.) with the Stripe plugin and wondering if anyone has already tackled this.
Would love to hear about your approaches or share ideas on how to best implement this!...
Best way for a plugin to extend session object
We’re trying to extend the session object in the
after
hook using createAuthMiddleware
. However, when we fetch the session on the client, it still uses the original session type.
What’s the recommended way to safely extend the session object with custom attributes while maintaining type safety?
We came across the customSession
plugin, which overrides the /get-session
route — but is that really the recommended approach for all plugins? It feels a bit hacky for something that should be more common....Solution:
Yeah I would recommend a new endpoint if using customSession isn't an option for you.
passing additional data from authClient to server betterAuth instance
is there a way to pass additional data from client to server when sending emails? For example when sending reset password email, instead of just sending the user's email and callbackUrl as data i also want to send locale which isn't part of the request body so i can generate the email with appropriate language
window.ethereum
When I visit the localhost on my phone I have this
window.ethereum
that comes up. I have 0 clue on where it comes from but according to my AI it's connected to my auth? - And yes I don't actually believe that it is but has anyone seen this before?
This also makes me unable to sign in/up in the form....API Keys at an organization level
I am new to better-auth and I want to use the organizations plugin with the api keys plugin. From what I saw in the documentation it looks like the api keys are tied to a user. I wanted to get api keys to work at an organization level instead. My initial thoughts are to use the anonymous plugin, and create "service" users for each organization and create api keys for the "service" user. I am using the anonymous plugin to avoid having to create a user with email and password. Is this a good approach or is there a better way of doing this? Thanks!
Note: I am building an API first application....
D1 incorrect dialect
I'm trying to create an auth instance with D1 and getting an error like
Type 'D1Dialect' is not assignable to type 'Dialect'.
The types returned by 'createDriver().acquireConnection()' are incompatible between these types.
Type 'Promise<import("<my-project>/node_modules/kysely/dist/esm/driver/database-connection").DatabaseConnection>' is not assignable to type 'Promise<import("<my-project>/node_modules/better-auth/node_modules/kysely/dist/esm/driver/database-connection").DatabaseConnection>'.
My code is like:...Solution:
Following up if anyone encounters this in the future. Could resolve this by using older versions of
kysely-d1
and kysely
.
Relevant package dependencies look like:
```
"better-auth": "^1.2.7",...Empty session in client after login and too many redirect
hello,
i'm try to login with username and password, its success but have no session available, it does have the cookie on the browser
but in middleware, the session its exist, but it the client using useSession() its not showing
using better-auth v.1.2.7...

admin plugin ban user - unauthorized
How do I ban a user in a server side route?
Thought thats the way how you perform actions on the server side
```
await auth.api.banUser({...
Solution:
provide headers, UNAUTHORIZED status is when you dont provide any authorization in your request
Post sign up hook for google provider
Hi, I've implemented a post sign up hook for an email provider where I send an internal event to my team when a user signs up. Now I would like to do the same for the google provider. Can you advice how I can identify when the user signs up (creates a new account) as opposed to logs in?
Here's my existing after hook
```
hooks: {...
fs.existsSync is unavailable
i get this ero in my expo + API routes app when i deployed on eas Hosting (i'll still try to host on vercel to see if problem persists). ```TypeError: EAS Hosting: fs.existsSync is unavailable (Workers have no filesystem)
at Object.fn [as existsSync] (__node_compat.js:904:11)
at _expo/functions/api/auth/[...auth]+api.js:298:17611
at g (_expo/functions/api/auth/[...auth]+api.js:2:1781)...
Hashing script to seed database
The palace project - the cases forI am trying to create a python script that lets me seed my database with dummy test data. I need to create some accounts but I want to be able to actually log into these accounts which means setting passwords. However, I'm struggling to work out how to set the password in the db.
I have tried a few different python scripts (my seeding is produced with python) but not succeeding so far. I have tried to mimic the same method used by better-auth.
```import os...
Using better-auth without a database
Hey, just a quick question,
Can I use better-auth to do this:
- oauth providers...