[PR #7660] feat(generic-oauth): add refreshTokenUrlParams to GenericOAuthConfig #24374

Open
opened 2026-04-15 22:20:22 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/7660
Author: @JoshWilkesQoria
Created: 1/28/2026
Status: 🔄 Open

Base: nextHead: feat/pass-extra-params-for-refresh-token-flow-in-generic-oauth-plugin


📝 Commits (3)

  • d89d9ce feat(generic-oauth): add refreshAccessToken extra params to GenericOAuthConfig
  • 6414eb1 Update parameter name for consistency
  • c561644 refactor(generic-oauth): rename refreshTokenParams to refreshTokenUrlParams

📊 Changes

4 files changed (+142 additions, -1 deletions)

View changed files

📝 docs/content/docs/plugins/generic-oauth.mdx (+5 -0)
📝 packages/better-auth/src/plugins/generic-oauth/generic-oauth.test.ts (+103 -0)
📝 packages/better-auth/src/plugins/generic-oauth/index.ts (+24 -1)
📝 packages/better-auth/src/plugins/generic-oauth/types.ts (+10 -0)

📄 Description

addresses https://github.com/better-auth/better-auth/issues/7554

This PR exposes the existing extraParams field for the refreshAccessToken function in the GenericOAuthConfig type, allowing additional data to be provided during the refresh token flow to support non standard OAuth server requirements.

Example usage:

genericOAuth({
      config: [
        {
          refreshAccessTokenExtraParams: {
            client_id: serverEnv.CLIENT_ID,
            redirect_uri: serverEnv.REDIRECT_URI,
          },
          // ...other config
        },
      ],
    }),

Summary by cubic

Adds refreshTokenUrlParams to GenericOAuthConfig and passes it as extraParams to refreshAccessToken so clients can include extra params in refresh token requests. Supports a static object or a function that receives GenericEndpointContext; if no request context is available, the params are skipped and a warning is logged.

Written for commit c561644148. 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/7660 **Author:** [@JoshWilkesQoria](https://github.com/JoshWilkesQoria) **Created:** 1/28/2026 **Status:** 🔄 Open **Base:** `next` ← **Head:** `feat/pass-extra-params-for-refresh-token-flow-in-generic-oauth-plugin` --- ### 📝 Commits (3) - [`d89d9ce`](https://github.com/better-auth/better-auth/commit/d89d9cea97126b1dc57d4e88d22b0d54ebb4185a) feat(generic-oauth): add refreshAccessToken extra params to GenericOAuthConfig - [`6414eb1`](https://github.com/better-auth/better-auth/commit/6414eb17991e213e475bcd2c2ccba9e08862ff3e) Update parameter name for consistency - [`c561644`](https://github.com/better-auth/better-auth/commit/c5616441483c6cd76e262d9a984a9cf0933ca135) refactor(generic-oauth): rename refreshTokenParams to refreshTokenUrlParams ### 📊 Changes **4 files changed** (+142 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `docs/content/docs/plugins/generic-oauth.mdx` (+5 -0) 📝 `packages/better-auth/src/plugins/generic-oauth/generic-oauth.test.ts` (+103 -0) 📝 `packages/better-auth/src/plugins/generic-oauth/index.ts` (+24 -1) 📝 `packages/better-auth/src/plugins/generic-oauth/types.ts` (+10 -0) </details> ### 📄 Description addresses https://github.com/better-auth/better-auth/issues/7554 This PR exposes the existing `extraParams` field for the refreshAccessToken function in the GenericOAuthConfig type, allowing additional data to be provided during the refresh token flow to support non standard OAuth server requirements. Example usage: ```typescript genericOAuth({ config: [ { refreshAccessTokenExtraParams: { client_id: serverEnv.CLIENT_ID, redirect_uri: serverEnv.REDIRECT_URI, }, // ...other config }, ], }), ``` <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Adds refreshTokenUrlParams to GenericOAuthConfig and passes it as extraParams to refreshAccessToken so clients can include extra params in refresh token requests. Supports a static object or a function that receives GenericEndpointContext; if no request context is available, the params are skipped and a warning is logged. <sup>Written for commit c5616441483c6cd76e262d9a984a9cf0933ca135. 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:20:22 -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#24374