[PR #8346] [MERGED] fix(account): use accountId instead of id in accountInfo endpoint #24814

Closed
opened 2026-04-15 22:34:17 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/8346
Author: @NathanColosimo
Created: 3/3/2026
Status: Merged
Merged: 3/4/2026
Merged by: @himself65

Base: canaryHead: fix/account-info-access-token-account-id


📝 Commits (3)

  • a1a7535 fix(account): use accountId instead of id in accountInfo endpoint
  • 34da55a Merge branch 'canary' into fix/account-info-access-token-account-id
  • 3634e0a test(account): add regression test for accountInfo using accountId

📊 Changes

2 files changed (+34 additions, -1 deletions)

View changed files

📝 packages/better-auth/src/api/routes/account.test.ts (+33 -0)
📝 packages/better-auth/src/api/routes/account.ts (+1 -1)

📄 Description

Summary

  • Fixes the accountInfo endpoint which was passing account.id (internal DB row ID) to getAccessToken, but getAccessToken matches on acc.accountId (the provider-issued account identifier). This caused account lookups to fail in 1.5.x.
  • This is the same class of bug that was fixed in #7216 for the getAccessToken endpoint itself, but the accountInfo endpoint was missed.

Change

account.idaccount.accountId on line 914 of packages/better-auth/src/api/routes/account.ts.

Patched in node_modules locally and this fixed the endpoint.

Closes #8345


Summary by cubic

Fixes the accountInfo endpoint to pass the provider-issued accountId instead of the internal id when calling getAccessToken. This restores correct account lookups in 1.5.x, aligns with the earlier getAccessToken fix, and adds a regression test to ensure accountId is used going forward.

Written for commit 3634e0a286. 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/8346 **Author:** [@NathanColosimo](https://github.com/NathanColosimo) **Created:** 3/3/2026 **Status:** ✅ Merged **Merged:** 3/4/2026 **Merged by:** [@himself65](https://github.com/himself65) **Base:** `canary` ← **Head:** `fix/account-info-access-token-account-id` --- ### 📝 Commits (3) - [`a1a7535`](https://github.com/better-auth/better-auth/commit/a1a75354a6738dd82128a8dbb6379df714c8cf29) fix(account): use accountId instead of id in accountInfo endpoint - [`34da55a`](https://github.com/better-auth/better-auth/commit/34da55a14481574057eda1987d54ea0cc0affba2) Merge branch 'canary' into fix/account-info-access-token-account-id - [`3634e0a`](https://github.com/better-auth/better-auth/commit/3634e0a286d3840aa3285637d06913dd7e776210) test(account): add regression test for accountInfo using accountId ### 📊 Changes **2 files changed** (+34 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `packages/better-auth/src/api/routes/account.test.ts` (+33 -0) 📝 `packages/better-auth/src/api/routes/account.ts` (+1 -1) </details> ### 📄 Description ## Summary - Fixes the `accountInfo` endpoint which was passing `account.id` (internal DB row ID) to `getAccessToken`, but `getAccessToken` matches on `acc.accountId` (the provider-issued account identifier). This caused account lookups to fail in 1.5.x. - This is the same class of bug that was fixed in #7216 for the `getAccessToken` endpoint itself, but the `accountInfo` endpoint was missed. ## Change `account.id` → `account.accountId` on line 914 of `packages/better-auth/src/api/routes/account.ts`. Patched in node_modules locally and this fixed the endpoint. Closes #8345 <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Fixes the accountInfo endpoint to pass the provider-issued accountId instead of the internal id when calling getAccessToken. This restores correct account lookups in 1.5.x, aligns with the earlier getAccessToken fix, and adds a regression test to ensure accountId is used going forward. <sup>Written for commit 3634e0a286d3840aa3285637d06913dd7e776210. 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-15 22:34:17 -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#24814