Better Auth

BA

Better Auth

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

Join

bug-reports

help

openid-configuration - Missing content-type header

It looks like the ’.well-known/openid-configuration’ endpoint is missing its content-type header of value application/json

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

Is there a way to extend fields for plugins?

I see that you can extend database values with the user or session table, but are you able to do it with other tables created by plugins, such as organizations?

api.auth.getSession calls SELECT session and SELECT user separately

Calling getSession, if it doesn't find a cookie, it sends 2 DB queries to select the session and then the user. It would be a lot more performant to send a single query with a join, avoiding waterfall latency

Failed to get session, when remember me is checked

im on latest version v.1.1.14 im using drizzle + postgress So when ever remember me is checked i get the error...
No description

Anonymous user account getting deleted on calling /get-session

Basically Anonymous user accounts are getting deleted after calling /get-session 2 or 3 times (have to set disableDeleteAnonymousUser to true for it to not delete). Also onLinkAccount is getting triggered when no account linking have taken place (only api call is /get-session) My auth config ``` anonymous({...

Bearer not including set-auth-token in the response headers.

I have followed the guide, included the plugin in the server plugins, but the context doesn't have any headers.

Callbacks issue in passkey plugin

```import { Key } from "lucide-react" import { Button } from "../ui/button" import { signIn } from "@/lib/auth-client" import { useAuthState } from "@/hooks/useAuthState"; ...

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

Error in signing up using cloudflare d1 database and drizzle orm on nextjs15

I've been trying to make the signup logic work, ive watch so 2 tutorials relating to the same techstack as mine and wrote same code as them but mine doesn't work at all gave same errors on all iterations. this error occurs when i submit the sign-up form, i have nothing in the code defined as "fullSchema" : ``` ERROR TypeError Cannot read properties of undefined (reading 'fullSchema') Better Auth...

warning! better-auth with Turbopack enabled

```⚠ ./node_modules/.pnpm/[email protected]/node_modules/better-auth/dist Package oslo can't be external The request oslo matches serverExternalPackages (or the default list). The request could not be resolved by Node.js from the project directory. Packages that should be external need to be installed in the project directory, so they can be resolved from the output files....

User is not able to ban user, even when he is admin of the org

getting {"message":"Only admins can access this endpoint","code":"ONLY_ADMINS_CAN_ACCESS_THIS_ENDPOINT"} , when client calls await admin.banUser({ userId: values.userId });...

issue getting session using mongodb

the login buttons work and i looking at the collection on mongodb it was able to insert the data, but when i try to check for a session on /dashboard using: ```ts auth.api.getSession({ headers: await headers() })...

High CPU usage when importing the library on a monorepo

As I am splitting my application into a monorepo solution using NX, I am facing performance issues with better-auth due to a recursive type in the automatic inference. The configuration it's pretty much straightforward: ```ts...
No description

timeout when get the body await request.json()

When making this request: ``` POST /api/test/auth/sign-in/email HTTP/1.1 Content-Type: application/json User-Agent: insomnia/9.3.3...
No description

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