[PR #2577] [MERGED] feat(docs): APIMethod, documents all server & client auth examples #21286

Closed
opened 2026-04-15 20:15:23 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/2577
Author: @ping-maxwell
Created: 5/7/2025
Status: Merged
Merged: 7/17/2025
Merged by: @Bekacru

Base: v1.3Head: feat/docs/api-method


📝 Commits (10+)

  • 295907e feat(docs): APIMethod, documents all server & client auth examples
  • 9cd1e34 update: api-method component to support @serverOnly
  • fda97d7 add: requireSession prop to APIMethod
  • eaa3da9 WIP: organization
  • b3a322c fix: removed fetchOptions
  • 0cfdcdd chore: cleanup api-method
  • 8bda956 update: API method design
  • 500243f add: anchor link to api-method component
  • 34b2517 update: api-method note component
  • e38c2c7 Update api-method.tsx

📊 Changes

53 files changed (+4800 additions, -966 deletions)

View changed files

📝 demo/nextjs/app/(auth)/two-factor/otp/page.tsx (+4 -4)
📝 docs/app/docs/[[...slug]]/page.tsx (+2 -0)
docs/components/api-method.tsx (+715 -0)
📝 docs/components/endpoint.tsx (+34 -24)
📝 docs/content/docs/authentication/email-password.mdx (+98 -41)
📝 docs/content/docs/plugins/2fa.mdx (+175 -91)
📝 docs/content/docs/plugins/admin.mdx (+258 -82)
📝 docs/content/docs/plugins/api-key.mdx (+204 -196)
📝 docs/content/docs/plugins/dub.mdx (+9 -3)
📝 docs/content/docs/plugins/email-otp.mdx (+74 -23)
📝 docs/content/docs/plugins/generic-oauth.mdx (+50 -10)
📝 docs/content/docs/plugins/magic-link.mdx (+41 -11)
📝 docs/content/docs/plugins/multi-session.mdx (+32 -13)
📝 docs/content/docs/plugins/oidc-provider.mdx (+89 -3)
📝 docs/content/docs/plugins/one-time-token.mdx (+20 -35)
📝 docs/content/docs/plugins/organization.mdx (+378 -196)
📝 docs/content/docs/plugins/passkey.mdx (+75 -16)
📝 docs/content/docs/plugins/phone-number.mdx (+76 -27)
📝 docs/content/docs/plugins/sso.mdx (+48 -0)
📝 docs/content/docs/plugins/stripe.mdx (+103 -11)

...and 33 more files

📄 Description

Added APIMethod component for docs

image

UI

Client:

image

Server:

image

This PR will also update all code examples to use this component.

Endpoint To Doc script

Introduced a script which allows you to paste the code of a createAuthEndpoint into the input.ts file.
After running the script, it will output the MDX code which represents that auth endpoint, then you can paste it into the docs.

When viewing a server-only endpoint:

image

Additional fixes in docs

  • email OTP docs doesn't document forgotPassword flow, but only documents resetPassword.
  • Passkey docs doesn't document listPasskeys, deletePasskey
  • admin docs doesn't document setUserPassword.
  • API Key didn't export the deleteAllExpiredApiKeys endpoint. Also fixed openAPI metadata for updateAPIKey endpoint.

🔄 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/2577 **Author:** [@ping-maxwell](https://github.com/ping-maxwell) **Created:** 5/7/2025 **Status:** ✅ Merged **Merged:** 7/17/2025 **Merged by:** [@Bekacru](https://github.com/Bekacru) **Base:** `v1.3` ← **Head:** `feat/docs/api-method` --- ### 📝 Commits (10+) - [`295907e`](https://github.com/better-auth/better-auth/commit/295907e2df08481be9a9a4f70e4b434c1ceccc49) feat(docs): APIMethod, documents all server & client auth examples - [`9cd1e34`](https://github.com/better-auth/better-auth/commit/9cd1e3485a049dc4546dfec6c408d489d98333a7) update: api-method component to support @serverOnly - [`fda97d7`](https://github.com/better-auth/better-auth/commit/fda97d7078ca44e16e5b67e0edc20efb47a94b55) add: requireSession prop to APIMethod - [`eaa3da9`](https://github.com/better-auth/better-auth/commit/eaa3da9156d36cb8c0cf7cf0767cfa7458c6bcf7) WIP: organization - [`b3a322c`](https://github.com/better-auth/better-auth/commit/b3a322cc1cc350d0c6deb0b3e4d0c595c27c6bf3) fix: removed `fetchOptions` - [`0cfdcdd`](https://github.com/better-auth/better-auth/commit/0cfdcdd62f149b74befd2141b03001e1c394ff63) chore: cleanup api-method - [`8bda956`](https://github.com/better-auth/better-auth/commit/8bda956ea36e5bb09ee049d53249526d26612b7e) update: API method design - [`500243f`](https://github.com/better-auth/better-auth/commit/500243f566f8f45ff1fef7c05b857a109c914481) add: anchor link to api-method component - [`34b2517`](https://github.com/better-auth/better-auth/commit/34b2517776e9a4585f8194321231bdf49db130b8) update: api-method note component - [`e38c2c7`](https://github.com/better-auth/better-auth/commit/e38c2c7014a720c582a697193521a9c3470d480b) Update api-method.tsx ### 📊 Changes **53 files changed** (+4800 additions, -966 deletions) <details> <summary>View changed files</summary> 📝 `demo/nextjs/app/(auth)/two-factor/otp/page.tsx` (+4 -4) 📝 `docs/app/docs/[[...slug]]/page.tsx` (+2 -0) ➕ `docs/components/api-method.tsx` (+715 -0) 📝 `docs/components/endpoint.tsx` (+34 -24) 📝 `docs/content/docs/authentication/email-password.mdx` (+98 -41) 📝 `docs/content/docs/plugins/2fa.mdx` (+175 -91) 📝 `docs/content/docs/plugins/admin.mdx` (+258 -82) 📝 `docs/content/docs/plugins/api-key.mdx` (+204 -196) 📝 `docs/content/docs/plugins/dub.mdx` (+9 -3) 📝 `docs/content/docs/plugins/email-otp.mdx` (+74 -23) 📝 `docs/content/docs/plugins/generic-oauth.mdx` (+50 -10) 📝 `docs/content/docs/plugins/magic-link.mdx` (+41 -11) 📝 `docs/content/docs/plugins/multi-session.mdx` (+32 -13) 📝 `docs/content/docs/plugins/oidc-provider.mdx` (+89 -3) 📝 `docs/content/docs/plugins/one-time-token.mdx` (+20 -35) 📝 `docs/content/docs/plugins/organization.mdx` (+378 -196) 📝 `docs/content/docs/plugins/passkey.mdx` (+75 -16) 📝 `docs/content/docs/plugins/phone-number.mdx` (+76 -27) 📝 `docs/content/docs/plugins/sso.mdx` (+48 -0) 📝 `docs/content/docs/plugins/stripe.mdx` (+103 -11) _...and 33 more files_ </details> ### 📄 Description ## Added `APIMethod` component for docs <img width="1723" alt="image" src="https://github.com/user-attachments/assets/5631f56f-1b6f-4e8c-8aa1-30d1e7a138a2" /> ## UI ### Client: <img width="1021" alt="image" src="https://github.com/user-attachments/assets/8722ae63-fc23-4b8b-adb2-9367de7a93b5" /> ### Server: <img width="903" alt="image" src="https://github.com/user-attachments/assets/550c5b80-7a58-4822-8ff8-28c71ed58e57" /> This PR will also update all code examples to use this component. ## Endpoint To Doc script Introduced a script which allows you to paste the code of a `createAuthEndpoint` into the `input.ts` file. After running the script, it will output the MDX code which represents that auth endpoint, then you can paste it into the docs. ## When viewing a server-only endpoint: <img width="889" alt="image" src="https://github.com/user-attachments/assets/ab55b309-197d-4df6-8a17-559416271a0f" /> ## Additional fixes in docs - email OTP docs doesn't document `forgotPassword` flow, but only documents `resetPassword`. - Passkey docs doesn't document `listPasskeys`, `deletePasskey` - admin docs doesn't document `setUserPassword`. - API Key didn't export the `deleteAllExpiredApiKeys` endpoint. Also fixed openAPI metadata for updateAPIKey endpoint. --- <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-04-15 20:15:23 -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#21286