[PR #6169] [CLOSED] feat: use scoped endpoints #6495

Closed
opened 2026-03-13 13:01:11 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/6169
Author: @jonathansamines
Created: 11/21/2025
Status: Closed

Base: canaryHead: feat/use-scoped-endpoints


📝 Commits (2)

  • 7782d28 feat: use scoped endpoints
  • 0cd4ecc chore: update test descriptions to avoid confusions

📊 Changes

28 files changed (+263 additions, -122 deletions)

View changed files

📝 docs/scripts/endpoint-to-doc/index.ts (+1 -1)
📝 packages/better-auth/src/api/routes/update-user.ts (+0 -4)
📝 packages/better-auth/src/api/to-auth-endpoints.ts (+6 -1)
📝 packages/better-auth/src/call.test.ts (+31 -0)
📝 packages/better-auth/src/client/client.test.ts (+14 -0)
📝 packages/better-auth/src/client/path-to-object.ts (+6 -0)
📝 packages/better-auth/src/client/test-plugin.ts (+38 -0)
📝 packages/better-auth/src/plugins/api-key/routes/delete-all-expired-api-keys.ts (+0 -5)
📝 packages/better-auth/src/plugins/api-key/routes/verify-api-key.ts (+0 -4)
📝 packages/better-auth/src/plugins/custom-session/custom-session.test.ts (+1 -0)
📝 packages/better-auth/src/plugins/email-otp/index.ts (+0 -4)
📝 packages/better-auth/src/plugins/jwt/index.ts (+0 -2)
📝 packages/better-auth/src/plugins/mcp/index.ts (+2 -1)
📝 packages/better-auth/src/plugins/oidc-provider/index.ts (+5 -6)
📝 packages/better-auth/src/plugins/open-api/generator.ts (+3 -2)
📝 packages/better-auth/src/plugins/open-api/index.ts (+2 -3)
📝 packages/better-auth/src/plugins/organization/routes/crud-members.ts (+0 -2)
📝 packages/better-auth/src/plugins/two-factor/backup-codes/index.ts (+0 -4)
📝 packages/better-auth/src/plugins/two-factor/totp/index.ts (+0 -2)
📝 packages/better-auth/src/types/api.ts (+28 -49)

...and 8 more files

📄 Description

Summary by cubic

Introduces scoped endpoints with server and http visibility and adds pathless virtual endpoints. Client types now exclude http- and server-scoped endpoints; OpenAPI/docs skip pathless endpoints to keep internals hidden.

  • New Features

    • Added endpoint scoping via metadata.scope ("server" | "http").
    • createAuthEndpoint supports pathless (virtual) endpoints.
    • HIDE_METADATA now sets scope: "server" and is used across plugins (OIDC, SSO, Expo, Stripe).
    • OpenAPI/doc generators skip endpoints without a path.
    • Type inference: clients exclude http-, server-scoped, and virtual endpoints; server API excludes http-scoped; getSession typing updated.
  • Refactors

    • Removed explicit SERVER_ONLY and paths from internal endpoints (API key ops, email OTP, JWT sign, org members, 2FA).
    • Updated better-call to 1.0.29.
    • Added tests for server-scoped calls and client type exclusions.

Written for commit 0cd4ecc36d. Summary will update automatically on new commits.


🔄 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/6169 **Author:** [@jonathansamines](https://github.com/jonathansamines) **Created:** 11/21/2025 **Status:** ❌ Closed **Base:** `canary` ← **Head:** `feat/use-scoped-endpoints` --- ### 📝 Commits (2) - [`7782d28`](https://github.com/better-auth/better-auth/commit/7782d28d54d9f5ad27cd2f19f1783b0812388f17) feat: use scoped endpoints - [`0cd4ecc`](https://github.com/better-auth/better-auth/commit/0cd4ecc36dc564c7105866b4a3fe64911984429d) chore: update test descriptions to avoid confusions ### 📊 Changes **28 files changed** (+263 additions, -122 deletions) <details> <summary>View changed files</summary> 📝 `docs/scripts/endpoint-to-doc/index.ts` (+1 -1) 📝 `packages/better-auth/src/api/routes/update-user.ts` (+0 -4) 📝 `packages/better-auth/src/api/to-auth-endpoints.ts` (+6 -1) 📝 `packages/better-auth/src/call.test.ts` (+31 -0) 📝 `packages/better-auth/src/client/client.test.ts` (+14 -0) 📝 `packages/better-auth/src/client/path-to-object.ts` (+6 -0) 📝 `packages/better-auth/src/client/test-plugin.ts` (+38 -0) 📝 `packages/better-auth/src/plugins/api-key/routes/delete-all-expired-api-keys.ts` (+0 -5) 📝 `packages/better-auth/src/plugins/api-key/routes/verify-api-key.ts` (+0 -4) 📝 `packages/better-auth/src/plugins/custom-session/custom-session.test.ts` (+1 -0) 📝 `packages/better-auth/src/plugins/email-otp/index.ts` (+0 -4) 📝 `packages/better-auth/src/plugins/jwt/index.ts` (+0 -2) 📝 `packages/better-auth/src/plugins/mcp/index.ts` (+2 -1) 📝 `packages/better-auth/src/plugins/oidc-provider/index.ts` (+5 -6) 📝 `packages/better-auth/src/plugins/open-api/generator.ts` (+3 -2) 📝 `packages/better-auth/src/plugins/open-api/index.ts` (+2 -3) 📝 `packages/better-auth/src/plugins/organization/routes/crud-members.ts` (+0 -2) 📝 `packages/better-auth/src/plugins/two-factor/backup-codes/index.ts` (+0 -4) 📝 `packages/better-auth/src/plugins/two-factor/totp/index.ts` (+0 -2) 📝 `packages/better-auth/src/types/api.ts` (+28 -49) _...and 8 more files_ </details> ### 📄 Description <!-- This is an auto-generated description by cubic. --> ## Summary by cubic Introduces scoped endpoints with server and http visibility and adds pathless virtual endpoints. Client types now exclude http- and server-scoped endpoints; OpenAPI/docs skip pathless endpoints to keep internals hidden. - **New Features** - Added endpoint scoping via metadata.scope ("server" | "http"). - createAuthEndpoint supports pathless (virtual) endpoints. - HIDE_METADATA now sets scope: "server" and is used across plugins (OIDC, SSO, Expo, Stripe). - OpenAPI/doc generators skip endpoints without a path. - Type inference: clients exclude http-, server-scoped, and virtual endpoints; server API excludes http-scoped; getSession typing updated. - **Refactors** - Removed explicit SERVER_ONLY and paths from internal endpoints (API key ops, email OTP, JWT sign, org members, 2FA). - Updated better-call to 1.0.29. - Added tests for server-scoped calls and client type exclusions. <sup>Written for commit 0cd4ecc36dc564c7105866b4a3fe64911984429d. Summary will update automatically on new commits.</sup> <!-- 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 13:01:11 -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#6495