[PR #8351] feat(account): support server-side accountInfo calls without session headers #16162

Open
opened 2026-04-13 10:25:00 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/8351
Author: @NathanColosimo
Created: 3/4/2026
Status: 🔄 Open

Base: mainHead: feat/account-info-server-side-support


📝 Commits (2)

  • be99223 align accountInfo with getAccessToken and update docs
  • 5617cd4 add changeset

📊 Changes

3 files changed (+28 additions, -4 deletions)

View changed files

.changeset/eager-cloths-stay.md (+5 -0)
📝 docs/content/docs/concepts/oauth.mdx (+4 -1)
📝 packages/better-auth/src/api/routes/account.ts (+19 -3)

📄 Description

Summary

  • Remove sessionMiddleware from accountInfo and add manual session resolution following the same pattern as getAccessToken
  • Add optional userId query parameter so server-side callers can use auth.api.accountInfo() without needing to construct session headers
  • Update docs to show the new userId parameter in the server-side example
  • Fully backwards compatible
  • Tested patching node_modules locally and it worked

Closes #8350


Summary by cubic

Enable server-side accountInfo calls without session headers by adding an optional userId and aligning auth with getAccessToken. Calls can use a session token or userId and remain backward compatible; docs now show a server-side example.

  • New Features
    • Added query.userId for server-side calls without session headers.
    • Replaced session middleware with manual session resolution; require session or userId and validate the account against the resolved user.

Written for commit 5617cd4606. Summary will update 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/8351 **Author:** [@NathanColosimo](https://github.com/NathanColosimo) **Created:** 3/4/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `feat/account-info-server-side-support` --- ### 📝 Commits (2) - [`be99223`](https://github.com/better-auth/better-auth/commit/be992234bf9659c63ff5ddbaf3a1893b3f220b91) align accountInfo with getAccessToken and update docs - [`5617cd4`](https://github.com/better-auth/better-auth/commit/5617cd4606f747fa6f55cbf39562ba5f94d22771) add changeset ### 📊 Changes **3 files changed** (+28 additions, -4 deletions) <details> <summary>View changed files</summary> ➕ `.changeset/eager-cloths-stay.md` (+5 -0) 📝 `docs/content/docs/concepts/oauth.mdx` (+4 -1) 📝 `packages/better-auth/src/api/routes/account.ts` (+19 -3) </details> ### 📄 Description ## Summary - Remove `sessionMiddleware` from `accountInfo` and add manual session resolution following the same pattern as `getAccessToken` - Add optional `userId` query parameter so server-side callers can use `auth.api.accountInfo()` without needing to construct session headers - Update docs to show the new `userId` parameter in the server-side example - Fully backwards compatible - Tested patching node_modules locally and it worked Closes #8350 <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Enable server-side accountInfo calls without session headers by adding an optional userId and aligning auth with getAccessToken. Calls can use a session token or userId and remain backward compatible; docs now show a server-side example. - **New Features** - Added `query.userId` for server-side calls without session headers. - Replaced session middleware with manual session resolution; require session or userId and validate the account against the resolved user. <sup>Written for commit 5617cd4606f747fa6f55cbf39562ba5f94d22771. Summary will update 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-04-13 10:25:00 -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#16162