[PR #4363] [CLOSED] feat(org): get organization #5332

Closed
opened 2026-03-13 12:19:07 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/4363
Author: @frectonz
Created: 9/2/2025
Status: Closed

Base: canaryHead: feat/get-organization


📝 Commits (10+)

  • 8ffb517 feat: get organization
  • c7faf5a chore: format
  • 5d8b743 feat(org): use a union for the orgId or orgSlug input
  • 93d914e docs(org): add getOrganization docs
  • ede3552 Merge branch 'canary' into feat/get-organization
  • ce43e82 feat(org): default to getting the active org
  • dec33e4 Merge branch 'canary' into feat/get-organization
  • c7db075 docs(org): fix some read or docs links
  • 87a1526 Merge branch 'canary' into feat/get-organization
  • e9b27c6 feat(org): return an error when activeOrganizationId is not available

📊 Changes

4 files changed (+145 additions, -5 deletions)

View changed files

📝 docs/content/docs/plugins/organization.mdx (+24 -0)
📝 packages/better-auth/src/plugins/organization/organization.test.ts (+19 -0)
📝 packages/better-auth/src/plugins/organization/organization.ts (+22 -5)
📝 packages/better-auth/src/plugins/organization/routes/crud-org.ts (+80 -0)

📄 Description

Done

  • Implement getOrganization
  • Document getOrganization
  • Add tests for it

Summary by cubic

Add a lightweight GET /organization/get endpoint and SDK methods to fetch basic organization info by ID or slug for a signed-in member. This complements getFullOrganization with a faster, minimal payload.

  • New Features
    • Endpoint: GET /organization/get
    • Query: organizationId or organizationSlug (one is required; if neither, returns 200 null)
    • Auth: requires headers; membership enforced via orgMiddleware and orgSessionMiddleware
    • Response: Organization object only (no members, invitations, or teams)
    • Errors: 400 if not found; 403 if user is not a member
    • SDK: auth.api.getOrganization and authClient.organization.getOrganization
    • Tests: added coverage for fetching an org and validating name/slug

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/better-auth/better-auth/pull/4363 **Author:** [@frectonz](https://github.com/frectonz) **Created:** 9/2/2025 **Status:** ❌ Closed **Base:** `canary` ← **Head:** `feat/get-organization` --- ### 📝 Commits (10+) - [`8ffb517`](https://github.com/better-auth/better-auth/commit/8ffb517b9bf0f769edc6c56a842b062bea9c0043) feat: get organization - [`c7faf5a`](https://github.com/better-auth/better-auth/commit/c7faf5af3152e6109701c5f2bfdfa37411aa1b69) chore: format - [`5d8b743`](https://github.com/better-auth/better-auth/commit/5d8b743c70fa71c1f6d7b1d41e34264d6ea0a9e0) feat(org): use a union for the orgId or orgSlug input - [`93d914e`](https://github.com/better-auth/better-auth/commit/93d914e9eea4d8fc8e9e9e9ad2c89b3d0cfef8ec) docs(org): add `getOrganization` docs - [`ede3552`](https://github.com/better-auth/better-auth/commit/ede355246158e7937a03acdd0a59fe4dbe58687f) Merge branch 'canary' into feat/get-organization - [`ce43e82`](https://github.com/better-auth/better-auth/commit/ce43e82ef8f61ecc1187dc3fbc022eeef350807c) feat(org): default to getting the active org - [`dec33e4`](https://github.com/better-auth/better-auth/commit/dec33e430aa93cc377ac894ab2f151d63d55843a) Merge branch 'canary' into feat/get-organization - [`c7db075`](https://github.com/better-auth/better-auth/commit/c7db0756ba43be915e9fad1f45c7816f552f7feb) docs(org): fix some read or docs links - [`87a1526`](https://github.com/better-auth/better-auth/commit/87a1526f04b67211252cc282ae35cfae7ce21c16) Merge branch 'canary' into feat/get-organization - [`e9b27c6`](https://github.com/better-auth/better-auth/commit/e9b27c66e673a6b8b0c4e053423af51e5f90de26) feat(org): return an error when `activeOrganizationId` is not available ### 📊 Changes **4 files changed** (+145 additions, -5 deletions) <details> <summary>View changed files</summary> 📝 `docs/content/docs/plugins/organization.mdx` (+24 -0) 📝 `packages/better-auth/src/plugins/organization/organization.test.ts` (+19 -0) 📝 `packages/better-auth/src/plugins/organization/organization.ts` (+22 -5) 📝 `packages/better-auth/src/plugins/organization/routes/crud-org.ts` (+80 -0) </details> ### 📄 Description ## Done - Implement `getOrganization` - Document `getOrganization` - Add tests for it <!-- This is an auto-generated description by cubic. --> ## Summary by cubic Add a lightweight GET /organization/get endpoint and SDK methods to fetch basic organization info by ID or slug for a signed-in member. This complements getFullOrganization with a faster, minimal payload. - **New Features** - Endpoint: GET /organization/get - Query: organizationId or organizationSlug (one is required; if neither, returns 200 null) - Auth: requires headers; membership enforced via orgMiddleware and orgSessionMiddleware - Response: Organization object only (no members, invitations, or teams) - Errors: 400 if not found; 403 if user is not a member - SDK: auth.api.getOrganization and authClient.organization.getOrganization - Tests: added coverage for fetching an org and validating name/slug <!-- End of auto-generated description by cubic. --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-03-13 12:19:07 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#5332