Organization: OrganizationClient does not seem to add interfaces to authClient
I am attempting to configure the Organization Plugin using Better Auth 1.3.7. I have the following server/client configuration:
And here is the client:
With the above config, when I attempt to use
What is going on here?
// server/lib/auth.ts
const { ac, roles } = OrganizationPluginOptions;
const betterAuthOptions = {
database: drizzleAdapter(db, {
provider: "pg",
schema: {
user: AuthUserTable,
account: AuthAccountTable,
session: AuthSessionTable,
verification: AuthVerificationTable,
organization: AuthOrganizationTable,
member: AuthOrganizationMemberTable,
team: AuthTeamTable,
teamMember: AuthTeamMemberTable,
invitation: AuthInvitationTable,
},
}),
advanced: {
database: {
generateId: false,
},
},
emailAndPassword: {
enabled: true,
},
plugins: [
admin(),
organization({
ac,
roles,
allowUserToCreateOrganization: false,
teams: {
enabled: true,
allowRemovingAllTeams: false,
},
}),
],
}
export const auth = betterAuth(betterAuthOptions);
export type ServerAuth = typeof auth;// server/lib/auth.ts
const { ac, roles } = OrganizationPluginOptions;
const betterAuthOptions = {
database: drizzleAdapter(db, {
provider: "pg",
schema: {
user: AuthUserTable,
account: AuthAccountTable,
session: AuthSessionTable,
verification: AuthVerificationTable,
organization: AuthOrganizationTable,
member: AuthOrganizationMemberTable,
team: AuthTeamTable,
teamMember: AuthTeamMemberTable,
invitation: AuthInvitationTable,
},
}),
advanced: {
database: {
generateId: false,
},
},
emailAndPassword: {
enabled: true,
},
plugins: [
admin(),
organization({
ac,
roles,
allowUserToCreateOrganization: false,
teams: {
enabled: true,
allowRemovingAllTeams: false,
},
}),
],
}
export const auth = betterAuth(betterAuthOptions);
export type ServerAuth = typeof auth;And here is the client:
import { OrganizationPluginOptions } from "@org/rbac";
import type { ServerAuth } from "@org/server/lib/auth";
import { createAuthClient } from "better-auth/client";
import { adminClient, inferAdditionalFields, organizationClient } from "better-auth/client/plugins";
const { ac, roles } = OrganizationPluginOptions;
export const authClient = createAuthClient({
baseURL: window.location.origin,
plugins: [
organizationClient({
ac,
roles,
teams: { enabled: true, allowRemovingAllTeams: false },
}),
inferAdditionalFields<ServerAuth>(),
],
});import { OrganizationPluginOptions } from "@org/rbac";
import type { ServerAuth } from "@org/server/lib/auth";
import { createAuthClient } from "better-auth/client";
import { adminClient, inferAdditionalFields, organizationClient } from "better-auth/client/plugins";
const { ac, roles } = OrganizationPluginOptions;
export const authClient = createAuthClient({
baseURL: window.location.origin,
plugins: [
organizationClient({
ac,
roles,
teams: { enabled: true, allowRemovingAllTeams: false },
}),
inferAdditionalFields<ServerAuth>(),
],
});With the above config, when I attempt to use
authClient.organizationauthClient.organization I only see checkRolePermissioncheckRolePermission as an available API and none of the other organization APIs (i.e. hasPermissionhasPermission, listMemberslistMembers, etc.).What is going on here?