cardinal
cardinal
BABetter Auth
Created by cardinal on 3/3/2025 in #help
Am trying to create an org when a user signed up.
Tried with database hooks but I don't think auth or authClient work. Does anyone has a working solution?
7 replies
BABetter Auth
Created by cardinal on 12/13/2024 in #help
Something broken with the customSession
plugins: [
customSession(async ({ user, session }) => {
const workspaces = await get_workspaces(user.id);
const onboarded = await has_completed_onboarding(user.id);

return {
user: {
...user,
onboarded: onboarded.ok,
workspace: workspaces[0]?.id,
},
session,
};
}),
],
plugins: [
customSession(async ({ user, session }) => {
const workspaces = await get_workspaces(user.id);
const onboarded = await has_completed_onboarding(user.id);

return {
user: {
...user,
onboarded: onboarded.ok,
workspace: workspaces[0]?.id,
},
session,
};
}),
],
it was working for me couple of days ago, but now it doesn't. The error it gave
Type '{ id: "custom-session"; endpoints: { getSession: { <C extends [(better_call.Context<"/get-session", { method: "GET"; metadata: { CUSTOM_SESSION: boolean; }; query: z.ZodOptional<z.ZodObject<{ disableCookieCache: z.ZodOptional<z.ZodUnion<[z.ZodBoolean, z.ZodEffects<z.ZodString, boolean, string>]>>; disableRefresh: z....' is not assignable to type 'BetterAuthPlugin'.
Types of property 'endpoints' are incompatible.
Type '{ id: "custom-session"; endpoints: { getSession: { <C extends [(better_call.Context<"/get-session", { method: "GET"; metadata: { CUSTOM_SESSION: boolean; }; query: z.ZodOptional<z.ZodObject<{ disableCookieCache: z.ZodOptional<z.ZodUnion<[z.ZodBoolean, z.ZodEffects<z.ZodString, boolean, string>]>>; disableRefresh: z....' is not assignable to type 'BetterAuthPlugin'.
Types of property 'endpoints' are incompatible.
1 replies