Better Auth

BA

Better Auth

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

Join

bug-reports

help

Issue with Account Overwriting When Using EXPO

After creating three projects on my computer, I logged in using Naver OAuth on two mobile devices. Each of these two projects is an individual EXPO app. One of them also has a backend server built with Express. Here’s the issue:...

Upgrading / switching plans does not cancel original subscription

Given I am on a cheap plan (fantasy in my case), when I upgrade to a more expensive plan (enthusiast in my case), then I would expect for the original plan to be cancelled. In reality, the database subscription is updated correctly (first image). However in Stripe I still have 2 subscriptions (second image). Please advise, thank you!...
No description

Organization plugin is broken according to typescript 5.9 beta?

full error message: ```txt src/auth.ts:41:9 - error TS2322: Type '{ id: "organization"; endpoints: { createOrganization: { <AsResponse extends boolean = false, ReturnHeaders extends boolean = false>(inputCtx_0: { body: { name: string; slug: string; userId?: string | undefined; logo?: string | undefined; metadata?: Record<...> | undefined; keepCurrentActiveOrganization?: boolean | ...' is not assignable to type 'BetterAuthPlugin'. Types of property 'schema' are incompatible....

SSO Sign In does not handle redirect to callbackUrl set in function

```const handleSSOSignIn = async () => { try { await authClient.signIn.sso({ organizationSlug: orgSlug, callbackURL: '/select-organization'...

SSO Plugin Schema does not include mappings

I'm unsure how or where the mappings I register in the SSO provider endpoint are being stored, but im not seeing them anywhere, so I'm curious as to how the registered SSO provider knows what to look for? I'm beginning to believe this is why everytime a user is SSO'd even though I get 200 for the response, I error out because the user it's trying to create is all null values which violates my db schema for not null columns.

better-auth cli failing with ECONREFUSED

Hello i am having an issue initially setting up better auth for a trial. The cli generate command is failing with spurious looking errors. node: 22.17.1 nextjs: ^15.0.3 cli: latest...
Solution:
Yeah it looks like it might be an ENV issue. Usually it's able to import .env files automatically tho, could it be that you have a different file name or using a different framework? 🤔

Exported variable 'auth' has or is using name 'OrganizationOptions'

error: Exported variable 'auth' has or is using name 'OrganizationOptions' from external module "/chao/react-hono-example/node_modules/better-auth/dist/plugins/organization/index" but cannot be named.ts(4023) See releated issue on github (2d ago): https://github.com/better-auth/better-auth/issues/3493 ...

v1.3.0 Organization - Session inference not working

When using the organization plugin and trying to infer the session:
typeof auth.$Infer.Session.session
typeof auth.$Infer.Session.session
...

Setting expiresAt override for internalAdapter.createSession doens't work

I'm trying to create a session using this function call: ``` const session = await ctx.context.internalAdapter.createSession( user.id,...

Google Provider prompt parameter type mismatch causes OAuth error

I'm encountering an issue with the Google OAuth provider configuration in better-auth. According to the documentation, to always get a refresh token, I should set prompt to "select_account+consent" as in documentation, but this causes a Google OAuth error. ``` socialProviders: { google: { clientId: process.env.GOOGLE_CLIENT_ID as string,...
Solution:
in better-auth 1.3.2 version error is fixed. So guys you ahve to just update ypur package.

Can't connect when api on different subdomains / domains

Hello, I have my api running on api.domain.io and my app on app.domain.io On my configuration I have ``` advanced: {...

Running cli to generate tables generates an error

Im working on a project and wanted to test auth the admin plugin, per the docs added the plugin to the auth.ts file and instead of migrating I wanted to generate the migration file...
npx @better-auth/cli generate
npx @better-auth/cli generate
I extracted the error from the log:...

Unable to login when adding cookies config section to auth.ts file (server config)

Hello, when attempting to add any configuration option relating to cookies the app the does not pass my session verification checks and kicks me back to the login screen. This goes for anything. I am mainly trying to enable the
useSecureCookies: true,
useSecureCookies: true,
option like this ```ts export const auth = betterAuth({ advanced: { useSecureCookies: true,...

Issue with custom table names

I've added such custom table names so it matches my db schema: ``` user: { deleteUser: { enabled: true...

Social login times out in production

hey everyone, i'm currently running into an issue where calling /api/auth/sign-in/social in production times out wheras it's working in local dev. can confirm all env vars are being pulled properly in production and that the production URL is properly set as an origin and a callback url through the gcloud dashboard. has anyone else run into the same issue?...
No description

Update session databaseHook uses Partial<Session> but passes Session to updateWithHook

I'm trying to make use of the updateSession databaseHook but am having issues with the types. Its params are a Partial<Session> but the expected return type is a full Session so even the following usage causes an error: ```typescript databaseHooks: { session: {...

apple error

Does anyone else also have problems setting up Apple Login? I'm getting following error on the Apple Login Page, after trying to complete the signup: Your request could not be completed because of an error. Please try again later....

MongoDB organization metadata stored as plain string

- Organization plugin - MongoDB adapter When adding custom metadata to an organization, it is stored as a JSON string in MongoDB. This mapping is unnecessary and suboptimal. While this behavior may be required for most database types, and so for the adapter, MongoDB natively supports JSON objects, and the metadata could be stored as such without stringifying it. ...

Trusted Origins Wildcards

Hello, I'm running into following error and I'm clueless if it's perhaps a BetterAuth Bug. I'm setting up my previews on Vercel and added following trustedOrigins into my list: https://*-my-team-gmbh.vercel.app but it's not working as expected. ...