[PR #2816] [MERGED] Fix Entra token refresh #12748

Closed
opened 2026-04-13 08:34:18 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/2816
Author: @CarbonNeuron
Created: 5/28/2025
Status: Merged
Merged: 5/28/2025
Merged by: @Kinfe123

Base: mainHead: fix/entra-refresh


📝 Commits (4)

  • 909d05a Add offline_access to default scopes for refresh
  • 8eae956 Include the scope param in token_refresh
  • 2a5ace4 Remove ClientKey from request, it's not needed
  • 4a2769f lint and format

📊 Changes

1 file changed (+9 additions, -2 deletions)

View changed files

📝 packages/better-auth/src/social-providers/microsoft-entra-id.ts (+9 -2)

📄 Description

This closes #2769 by fixing the token refresh mechanism for Entra ID.

From Microsoft's documentation here we need to include the "scope" parameter when refreshing the access token.

We also need to include the offline_access scope when requesting token, which is documented here so I have added that to the default scopes.


🔄 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/2816 **Author:** [@CarbonNeuron](https://github.com/CarbonNeuron) **Created:** 5/28/2025 **Status:** ✅ Merged **Merged:** 5/28/2025 **Merged by:** [@Kinfe123](https://github.com/Kinfe123) **Base:** `main` ← **Head:** `fix/entra-refresh` --- ### 📝 Commits (4) - [`909d05a`](https://github.com/better-auth/better-auth/commit/909d05a022ab7e384016b44180f585668960ed93) Add offline_access to default scopes for refresh - [`8eae956`](https://github.com/better-auth/better-auth/commit/8eae956d56f231ffcb554d0c7c0fc8ec9123a060) Include the scope param in token_refresh - [`2a5ace4`](https://github.com/better-auth/better-auth/commit/2a5ace42f9b157239913f221d5873e5342946d8a) Remove ClientKey from request, it's not needed - [`4a2769f`](https://github.com/better-auth/better-auth/commit/4a2769f2f8958fdc8234964ff02f1c5569511e1d) lint and format ### 📊 Changes **1 file changed** (+9 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `packages/better-auth/src/social-providers/microsoft-entra-id.ts` (+9 -2) </details> ### 📄 Description This closes #2769 by fixing the token refresh mechanism for Entra ID. From Microsoft's documentation [here](https://learn.microsoft.com/en-us/graph/auth-v2-user?tabs=http#step-4-use-the-refresh-token-to-renew-an-expired-access-token) we need to include the "scope" parameter when refreshing the access token. We also need to include the `offline_access` scope when requesting token, which is documented [here](https://learn.microsoft.com/en-us/graph/auth-v2-user?tabs=http#response-body-properties) so I have added that to the default scopes. --- <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 08:34:18 -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#12748