kaas
kaas
BABetter Auth
Created by kaas on 2/22/2025 in #help
Microsoft login
Following the docs, newest version: 2025-02-22T11:20:43.974Z ERROR [Better Auth]: TypeError [TypeError: The "payload" argument must be of type object. Received null] { code: 'ERR_INVALID_ARG_TYPE' } When logging in with Microsoft? And error 500 How come?
11 replies
BABetter Auth
Created by kaas on 2/12/2025 in #bug-reports
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.
13 replies
BABetter Auth
Created by kaas on 11/13/2024 in #bug-reports
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",
"logo": "xxxx",
"createdAt": "2024-11-13T22:41:58.099Z",
"invitations": [],
"members": [
{
"id": "HBPdjO-To6nXxD3uRmSXr",
"organizationId": "RbK9SjPZKhd-laZiqO_dS",
"userId": "wcfOn5-iM9zyynNRY7gtp",
"role": "owner",
"createdAt": "2024-11-13T22:41:58.162Z",
"user": {
"id": "wcfOn5-iM9zyynNRY7gtp",
"name": "xxxxx",
"email": "xxxx",
{
"id": "RbK9SjPZKhd-laZiqO_dS",
"name": "xxxxx",
"slug": "xxx",
"logo": "xxxx",
"createdAt": "2024-11-13T22:41:58.099Z",
"invitations": [],
"members": [
{
"id": "HBPdjO-To6nXxD3uRmSXr",
"organizationId": "RbK9SjPZKhd-laZiqO_dS",
"userId": "wcfOn5-iM9zyynNRY7gtp",
"role": "owner",
"createdAt": "2024-11-13T22:41:58.162Z",
"user": {
"id": "wcfOn5-iM9zyynNRY7gtp",
"name": "xxxxx",
"email": "xxxx",
It drops the entire tables out back to the user just for setting active - Where API endpoint get-full-org is pulled right after. I think ths API endpoint should return false/true if its set, and not return the whole objects.
27 replies
BABetter Auth
Created by kaas on 11/12/2024 in #bug-reports
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

export const auth = betterAuth({
database: mongodbAdapter(client)
});
import { betterAuth } from "better-auth";
import { mongodbAdapter } from "better-auth/adapters/mongodb";
import { client } from "@/db/index"; // Importing specifically from index

export const auth = betterAuth({
database: mongodbAdapter(client)
});
my db instance index.ts
import { MongoClient } from "mongodb";

const uri = "mongodb://localhost:27017";
const client = new MongoClient(uri);

export async function connectToDatabase() {
if (!client.isConnected()) {
await client.connect();
}
return client.db("testdb");
}

export { client };
import { MongoClient } from "mongodb";

const uri = "mongodb://localhost:27017";
const client = new MongoClient(uri);

export async function connectToDatabase() {
if (!client.isConnected()) {
await client.connect();
}
return client.db("testdb");
}

export { client };
"mongodb is not supported" when doing generate. "
44 replies
BABetter Auth
Created by kaas on 11/1/2024 in #bug-reports
[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",
password: "password123",
role: "user"
});
const newUser = await authClient.admin.createUser({
name: "Test User",
password: "password123",
role: "user"
});
Does not adhere to any custom fields made in auth.ts I've added
additionalFields: {
firstName: {
type: "string",
required: true,
},
lastName: {
type: "string",
required: true,
},``
additionalFields: {
firstName: {
type: "string",
required: true,
},
lastName: {
type: "string",
required: true,
},``
The only fields it seems to take into consideration is the pre-defined fields that are found in the docs
name: "Test User",
password: "password123",
role: "user"
name: "Test User",
password: "password123",
role: "user"
eg:
id: "0_XCvVtlUk4bLELI_mCQ-",
name: "undefined undefined",
emailVerified: false,
image: undefined,
createdAt: new Date("2024-11-01T20:41:18.890Z"),
updatedAt: new Date("2024-11-01T20:41:18.890Z"),
role: "user",
banned: undefined,
banReason: undefined,
banExpires: undefined,
lastName: undefined,
street: undefined,
zip: undefined,
city: undefined,
country: undefined,
phoneNumber: undefined,
lang: undefined,
id: "0_XCvVtlUk4bLELI_mCQ-",
name: "undefined undefined",
emailVerified: false,
image: undefined,
createdAt: new Date("2024-11-01T20:41:18.890Z"),
updatedAt: new Date("2024-11-01T20:41:18.890Z"),
role: "user",
banned: undefined,
banReason: undefined,
banExpires: undefined,
lastName: undefined,
street: undefined,
zip: undefined,
city: undefined,
country: undefined,
phoneNumber: undefined,
lang: undefined,
All fields are undefined, but they are parsed to the function correctly.
7 replies