Better Auth

BA

Better Auth

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

Join

bug-reports

help

Updating organization metadata

Currently, after updating organization metadata, the metadata gets stringified twice, causing the data to be stored as '[object object]' This should solve the problem theoretically by checking if the metadata already a string or not and stringifiying it based on that. I didn't have time to create a PR and clone the project so i just drafted this quickly from what I saw in the file File path: packages/better-auth/src/plugins/organization/adapter.ts ...

organization.acceptInvitation is throwing exception on sqlite - d1

ERROR Error D1_ERROR: near "where": syntax error at offset 22: SQLITE_ERROR Better Auth at processTicksAndRejections (node:internal/process/task_queues:95:5) at D1PreparedQuery.all (node_modules/src/d1/session.ts:194:16) at withReturning (node_modules/better-auth/dist/adapters/drizzle.js:1:8808)...

Typescript additional fields date type error

Jumping straight to example: Add additional fields in the db schema and in the auth config `user: { additionalFields: { birthday: { type: 'string', default: null },...

Unable to use `mongodb` client

Hey there, I am having an issue using MongoDB with Better Auth. I have correctly initialized a mongodb client it seems, but Better Auth seems to be having an issue with it. If you have any pointers on how I might begin to debug this, I would greatly appreciate it. Error following authClient.signUp(). I can send the full error if needed by I am limited by Discord's post length here. Here the database is connected successfully. ``` โœ“ Compiled /api/auth/[...all] in 919ms...

Fix support to Bunx

When I want to use the cli's generate service with bunx (I don't have node or I shouldn't have node installed), it doesn't work... I force myself to install node and it does run with npx ๐Ÿ’€...
No description

In EmailOTP Plugin, the user is notVerified after signIn.

Once the signIn is done via OTP, the user's isVerified column still says false. The user should be marked as verified on signIn.

Example Support Auth Remix.js

Hi everyone, I'm trying to make a usage example for Remix.js Auth and theoretically it works but when I use the client methods it says I'm not authorized. https://remix.run/resources/remix-auth...
No description

No control Over credentials on server side

Current Version: 0.8.6-beta.3 Tech Stack: Nextjs I applied email and password login in my project it works fine when we send a request from client to server and it checks with zod for client side validation and passes data correctly. But if we i use postman to send a request with credential information i have no control to check if the password or confirm password is correct or if password is in correct format. Even if i send wrong type of information using postman if accepts and creates a new user without a check at server. ...
No description

Permissions type not updating after creating ac and adding to organization plugin.

Hi, I believe this is a bug, even after adding my own permissions.ts, and adding ac and all of the roles to my auth.ts and auth-client.ts, it shows that the only permissions available are the 3 default ones built into the plugin. Is there any more setup that needs to be done that I'm missing? I've looked through the source of better-auth and cant pinpoint the issue ```import { createAccessControl } from "better-auth/plugins/access"; const statement = {...
No description

oslo package

better-auth version: 0.8.6-beta.3
No description

Signin throws an occasional not valid JSON error

Hey everyone, I have a signin server action which simply lets user signin , but sometimes it throws a 500 error saying "<", "!DOCTYPE" ... is not valid JSON, I dont know what might cause this, also it can be the (Turso) database error, but am not sure, Why does it throw error occasionally or only at certain times? sometimes its quite frequent and gives very bad UX. This is my signin code : `signin: async ({ request, cookies }) => { let form = await request.formData(); let email = form.get('email') as string;...
No description

EDE in API endpoint set-active

API endpoint to set active org -> Is showing alot of information ```{ "id": "RbK9SjPZKhd-laZiqO_dS", "name": "xxxxx", "slug": "xxx",...

MongoDB

Fresh install nextjs following docs - And using the following for mongodb auth.ts ```import { betterAuth } from "better-auth"; import { mongodbAdapter } from "better-auth/adapters/mongodb"; import { client } from "@/db/index"; // Importing specifically from index...

Server auth not working (SvelteKit) via signin with email

Hey everyone, When I try to sign in with email and with server actions, the session doesnt seem to set or authentication simply doesnt complete In this code: `try { let res = await auth.api.signInEmail({ body: {...

Github Oauth not working in production

Hey everyone, I have a web app built with SvelteKit, for oauth with github everything works well and as expected in development environment or for localhost app, but things break and in console a 500 (Internal Server Error) logs out, am really not sure why is this happening, I have just followed the instructions from docs as it is, Help would be really appreciated. I don't know if it requires reproduction, cause there's nothing different going on from the docs steps, its just things dont work in production (Also, I deploy on cloudflare pages.)...

Failed to get source map when using auth.api.getSession() during first request

Hey there ๐Ÿ‘‹, I am having an issue getting my session on the server in a single request. Currently, it seems that two requests are being made for session data, and as for a brief moment, components accessing session data using useSession() render improperly. Has anyone had this issue before? Where can I begin to debug? ```GET /api/auth/session 401 in 78ms...

[Not sure if bug] Admin plugin does not use the Infering Types

As title says Using the create user ```const newUser = await authClient.admin.createUser({ name: "Test User",...

crossSubDomainCookies no stored state found

Hello, I am trying to configure lcross SubDomainCookies and I am receiving the following error when trying to log in No stored state found everything works fine until I activate crossSubDomainCookies this is my settins in auth.ts : advanced:{...
No description

'import.meta' is currently unsupported, js engine: hermes [Component Stack]

โ€ฆimport {env as p} from โ€œstd-envโ€; Iโ€™m getting this in an Expo/React Native project. The Metro Bundler has no import.meta support yet and it seems like this could take a while...