Better Auth

BA

Better Auth

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

Join

bug-reports

help

Manually verifying magic link token throws unexpected invalid_type

In my Expo mobile app, I'm trying to verify the magic link token manually as described here. But when I try to call the verify method with my token, I receive the following error: ```{"code": "__CODE_INVALID_TYPEEXPECTED_STRINGRECEIVED_UNDEFINEDPATH___TOKEN__MESSAGE_REQUIRED__", "details": [{"code": "invalid_type", "expected": "string", "message": "Required", "path": [Array], "received": "undefined"}], "message": "[ { "code": "invalid_type",...

Session stealing?

Not sure if this is actually a bug. But try opening better auth in two windows (one in normal, one in incognito). Doing a few refreshses etc - And suddenly user 1 will become user 2? The browsers are totally seperated? Running newest stable version of better-auth. Tried this also on a public facing one and the same happend....

Using useListOrganization() causes API to call `/api/auth/t-o-j-s-o-n`

I am trying to design an org select screen in react: ``` export function OrganizationSelectScreen() { const organizationsQuery = useQuery({...
No description

'"better-auth/plugins"' has no exported member 'sessionMiddleware'.

Expected behaviour: I should be able to import sessionMiddleware from the better-auth plugin to verify if a user has an active session. Current behaviour: When attempting to use sessionMiddleware from the better-auth plugin, I encounter an error indicating that the module has no exported member named sessionMiddleware....

Session Cache disappearing in Next.js

Expected behavior: Cached session refreshes in cookies every 30 seconds Current behavior: Cached session disappears after 30 seconds and never gets refreshed, leaving better-auth to default back to bringing the session from the database....

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 ...

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 },...

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...

[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",...