Missing functions in organization plugin: getActiveOrganization and listOrganziations.
getActiveOrganization is not implemented in the plugin.
I can find listOrganizations in the sourcecode, bud when I do auth.api.listOrganizations (server side) it sells me the property does not exist on type 'InferApi'.
Any advice here?
My plugins auth.ts:
plugins: [
openAPI(),
twoFactor(),
passkey(),
organization(),
reactStartCookies()
]
Client:
import {
adminClient,
emailOTPClient,
magicLinkClient,
multiSessionClient,
organizationClient,
passkeyClient,
twoFactorClient,
} from 'better-auth/client/plugins';
import { createAuthClient } from 'better-auth/react';
import { env } from '@/lib/env.client';
import {
ac,
admin as adminRole,
superadmin as superAdminRole,
user as userRole,
} from './permissions';
export const authClient = createAuthClient({
baseURL: env.VITE_SERVER_URL,
plugins: [
twoFactorClient(),
passkeyClient(),
adminClient({
ac,
roles: {
user: userRole,
admin: adminRole,
superadmin: superAdminRole,
},
}),
organizationClient(),
emailOTPClient(),
magicLinkClient(),
multiSessionClient(),
],
});
export type AuthClient = ReturnType<typeof createAuthClient>;
5 Replies
I am on latest.
Are you in a monorepo?
Yes but with no hoist.
Can you show me your full auth config? and the tsconfig of that auth project
Not to hijack the issue, but I've got a very similar issue, and I suspect it's the same issue. In my case, I think it was caused by adding
"exactOptionalPropertyTypes": true
to tsconfig
. I'm not too sure why I added this property, but removing it resolved my issue which matches OP's issue.