[PR #2557] [MERGED] feat: add getAccessToken api for oauth accounts #4377

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

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/2557
Author: @BlankParticle
Created: 5/6/2025
Status: Merged
Merged: 5/7/2025
Merged by: @Bekacru

Base: mainHead: feat/get-access-token


📝 Commits (6)

  • 4dab598 feat: add getAccessToken api for oauth accounts
  • dc5d1c0 fix: remove returning refresh token and refactor
  • c6fa945 add docs
  • b827194 chore: move both access and refresh token to account
  • c9aa148 chore: refactor to account.ts
  • 03e8ffa chore: mention refresh on getAcessToken

📊 Changes

5 files changed (+348 additions, -129 deletions)

View changed files

📝 docs/content/docs/concepts/oauth.mdx (+67 -0)
📝 packages/better-auth/src/api/index.ts (+2 -0)
📝 packages/better-auth/src/api/routes/account.ts (+279 -3)
📝 packages/better-auth/src/api/routes/index.ts (+0 -1)
packages/better-auth/src/api/routes/refresh-token.ts (+0 -125)

📄 Description

Added a getAccessToken api that returns a valid access token after refreshing if necessary.
Useful for server side logic which needs to use the access token to call apis on behalf of users.


🔄 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/2557 **Author:** [@BlankParticle](https://github.com/BlankParticle) **Created:** 5/6/2025 **Status:** ✅ Merged **Merged:** 5/7/2025 **Merged by:** [@Bekacru](https://github.com/Bekacru) **Base:** `main` ← **Head:** `feat/get-access-token` --- ### 📝 Commits (6) - [`4dab598`](https://github.com/better-auth/better-auth/commit/4dab5982df854bc4b5b5c394b172b2fc56b4da87) feat: add getAccessToken api for oauth accounts - [`dc5d1c0`](https://github.com/better-auth/better-auth/commit/dc5d1c0abfccc58f379be114a6652b3b1d365b0d) fix: remove returning refresh token and refactor - [`c6fa945`](https://github.com/better-auth/better-auth/commit/c6fa9453bc1a991effc2e18a9064de9b44186b86) add docs - [`b827194`](https://github.com/better-auth/better-auth/commit/b82719412cec14518d744a0ee8ba035e1c0fe883) chore: move both access and refresh token to account - [`c9aa148`](https://github.com/better-auth/better-auth/commit/c9aa1488707e1786630ee442390d0d423102a109) chore: refactor to account.ts - [`03e8ffa`](https://github.com/better-auth/better-auth/commit/03e8ffa57d2089302d54e4d87ad37253b2288054) chore: mention refresh on getAcessToken ### 📊 Changes **5 files changed** (+348 additions, -129 deletions) <details> <summary>View changed files</summary> 📝 `docs/content/docs/concepts/oauth.mdx` (+67 -0) 📝 `packages/better-auth/src/api/index.ts` (+2 -0) 📝 `packages/better-auth/src/api/routes/account.ts` (+279 -3) 📝 `packages/better-auth/src/api/routes/index.ts` (+0 -1) ➖ `packages/better-auth/src/api/routes/refresh-token.ts` (+0 -125) </details> ### 📄 Description Added a `getAccessToken` api that returns a valid access token after refreshing if necessary. Useful for server side logic which needs to use the access token to call apis on behalf of users. --- <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 11:43:28 -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#4377