{"id":18156,"library":"better-auth-organization-member","title":"better-auth-organization-member","description":"A Better Auth plugin that extends the organization plugin with member update capabilities and automatic hook injection for invitation-to-member data transfer. Version 1.0.9 requires better-auth >= 1.4.9 and the organization plugin. Ships TypeScript types, supports additional fields (firstName, lastName, avatar, custom) with full type inference via inferOrgMemberAdditionalFields. Key differentiators: no manual hooks, automatic afterAcceptInvitation hook injection, lifecycle hooks for before/after update, and both server and client packages.","status":"active","version":"1.0.9","language":"javascript","source_language":"en","source_url":null,"tags":["javascript","typescript"],"install":[{"cmd":"npm install better-auth-organization-member","lang":"bash","label":"npm"},{"cmd":"yarn add better-auth-organization-member","lang":"bash","label":"yarn"},{"cmd":"pnpm add better-auth-organization-member","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency; required for OAuth provider integration","package":"@better-auth/oauth-provider","optional":false},{"reason":"Peer dependency; core authentication library","package":"better-auth","optional":false}],"imports":[{"note":"ESM-only since v1; ships types","wrong":"const { organizationMember } = require('better-auth-organization-member')","symbol":"organizationMember","correct":"import { organizationMember } from 'better-auth-organization-member'"},{"note":"Client-side plugin is in /client subpath; not exported from main entry","wrong":"import { organizationMemberClient } from 'better-auth-organization-member'","symbol":"organizationMemberClient","correct":"import { organizationMemberClient } from 'better-auth-organization-member/client'"},{"note":"Helper for full type inference, exported from /client only","wrong":"import { inferOrgMemberAdditionalFields } from 'better-auth-organization-member'","symbol":"inferOrgMemberAdditionalFields","correct":"import { inferOrgMemberAdditionalFields } from 'better-auth-organization-member/client'"}],"quickstart":{"code":"import { betterAuth } from 'better-auth';\nimport { organization } from 'better-auth/plugins';\nimport { organizationMember } from 'better-auth-organization-member';\n\nexport const auth = betterAuth({\n  plugins: [\n    organization({\n      schema: {\n        member: {\n          additionalFields: {\n            firstName: { type: 'string', input: true, required: false },\n            lastName: { type: 'string', input: true, required: false },\n            avatar: { type: 'string', input: true, required: false },\n          },\n        },\n        invitation: {\n          additionalFields: {\n            firstName: { type: 'string', input: true, required: false },\n            lastName: { type: 'string', input: true, required: false },\n            avatar: { type: 'string', input: true, required: false },\n          },\n        },\n      },\n    }),\n    organizationMember({\n      schema: {\n        member: {\n          additionalFields: {\n            firstName: { type: 'string', input: true, required: false },\n            lastName: { type: 'string', input: true, required: false },\n            avatar: { type: 'string', input: true, required: false },\n          },\n        }\n      },\n      organizationMemberHooks: {\n        async beforeUpdateMember(data) {\n          return { data: { ...data.updates } };\n        },\n      },\n    }),\n  ],\n});\n\n// Client setup\nimport { createAuthClient } from 'better-auth/client';\nimport { organizationClient } from 'better-auth/client/plugins';\nimport { organizationMemberClient, inferOrgMemberAdditionalFields } from 'better-auth-organization-member/client';\nimport type { auth } from './auth';\n\nconst client = createAuthClient({\n  plugins: [\n    organizationClient({\n      schema: inferOrgMemberAdditionalFields<typeof auth>()\n    }),\n    organizationMemberClient({\n      schema: inferOrgMemberAdditionalFields<typeof auth>()\n    })\n  ],\n});\n\n// Update member\nawait client.organization.updateMember({\n  memberId: 'member-id',\n  data: {\n    role: 'admin',\n    firstName: 'Jane',\n    lastName: 'Doe',\n    avatar: 'https://example.com/avatar.png'\n  }\n});","lang":"typescript","description":"Shows server and client setup with custom additional fields, automatic hook injection, and member update call."},"warnings":[{"fix":"Ensure organization plugin is listed first in the plugins array, then organizationMember","message":"organizationMember plugin must be added after the organization plugin; else hook injection may fail or cause unexpected behavior","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Use import { organizationMemberClient } from 'better-auth-organization-member/client'","message":"Client plugin (organizationMemberClient) must import from 'better-auth-organization-member/client', not the main package; main package does not export client functions","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Either import type { auth } from './auth' and pass to generic, or define schema object manually","message":"Type inference helper inferOrgMemberAdditionalFields requires TypeScript and the auth object type to be imported; if auth type is not available, schema must be defined manually","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Use dynamic import() or switch project to ESM; set 'type': 'module' in package.json","message":"Plugin is ESM-only; CommonJS require() will fail with ERR_REQUIRE_ESM","severity":"breaking","affected_versions":">=1.0.0"},{"fix":"Upgrade Node to version 22 or later","message":"Node engines specified >=22; older Node versions will fail to install or run","severity":"deprecated","affected_versions":">=1.0.0"}],"env_vars":null,"search_vec":"'1.0.9':31 '1.4.9':36 'addit':45 'afteracceptinvit':63 'auth':3,8,35 'automat':20,62 'avatar':49 'before/after':69 'better':2,7,34 'better-auth':33 'better-auth-organization-memb':1 'capabl':18 'client':75 'custom':50 'data':28 'differenti':58 'extend':11 'field':46 'firstnam':47 'full':52 'hook':21,61,64,67 'infer':54 'inferorgmemberadditionalfield':56 'inject':22,65 'invit':25 'invitation-to-memb':24 'javascript':77 'key':57 'lastnam':48 'lifecycl':66 'manual':60 'member':5,16,27 'organ':4,13,39 'packag':76 'plugin':9,14,40 'requir':32 'server':73 'ship':41 'support':44 'transfer':29 'type':43,53 'typescript':42,78 'updat':17,70 'version':30 'via':55","created_at":"2026-04-25T07:36:45.309360+00:00","updated_at":"2026-04-25T07:36:45.309360+00:00","problems":[{"fix":"Change to import statement or use dynamic import(). Also ensure 'type': 'module' in package.json","cause":"Using require() on ESM-only package better-auth-organization-member","error":"ERR_REQUIRE_ESM"},{"fix":"Add organization plugin before organizationMember, and define schema for member.additionalFields if using custom fields","cause":"organizationMember plugin not added after organization plugin, or organization plugin missing schema","error":"TypeError: Cannot read properties of undefined (reading 'additionalFields')"},{"fix":"Run npm install better-auth-organization-member. If using TypeScript, ensure moduleResolution is set to bundler or node16","cause":"Missing installation or incorrect path; package must be installed","error":"Module not found: Error: Can't resolve 'better-auth-organization-member/client'"},{"fix":"Use inferOrgMemberAdditionalFields<typeof auth>() properly; ensure auth is exported as a type","cause":"Passing auth object type incorrectly; inferOrgMemberAdditionalFields expects a generic type parameter","error":"TypeScript error: Type '{}' is not assignable to type 'InferOrgMemberAdditionalFields<AuthType>'"},{"fix":"Remove manually defined afterAcceptInvitation hook from organization plugin config; let organizationMember handle it","cause":"Manually defining afterAcceptInvitation hook in organization plugin conflicts with automatic injection","error":"Error: afterAcceptInvitation hook already exists"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":"","cli_version":null,"type":"library","homepage":null,"github":null,"docs":null,"changelog":null,"pypi":null,"npm":"https://www.npmjs.com/package/better-auth-organization-member","openapi_spec":null,"status_page":null,"smithery":null,"categories":["auth-security","web-framework"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-17","next_check":"2026-07-24","install_tag":null}}