[GH-ISSUE #1064] In Generic OAuth plugin, add option to send additional custom OAuth parameters #8576

Closed
opened 2026-04-13 03:41:45 -05:00 by GiteaMirror · 2 comments
Owner

Originally created by @mpnow on GitHub (Dec 30, 2024).
Original GitHub issue: https://github.com/better-auth/better-auth/issues/1064

Is this suited for github?

  • Yes, this is suited for github

Some OAuth providers support the use of additional querystring parameters when calling their authorization endpoints. (For example, Asana supports sending the parameter display_ui=always in which case the user will be shown the Asana authorization dialog even if they have previously authorized the app.) Currently there is no support in the Generic OAuth plugin for passing additional custom parameters such as this.

Describe the solution you'd like

I would like to see support added to the Generic OAuth plugin for passing additional custom parameters to the OAuth authorization endpoint. This could be defined by adding an additionalParameters option to the Generic OAuth plugin configuration.

Describe alternatives you've considered

I'm unable to think of any alternative ways to pass an additional custom parameter.

Additional context

No response

Originally created by @mpnow on GitHub (Dec 30, 2024). Original GitHub issue: https://github.com/better-auth/better-auth/issues/1064 ### Is this suited for github? - [X] Yes, this is suited for github ### Is your feature request related to a problem? Please describe. Some OAuth providers support the use of additional querystring parameters when calling their authorization endpoints. (For example, Asana supports sending the parameter `display_ui=always` in which case the user will be shown the Asana authorization dialog even if they have previously authorized the app.) Currently there is no support in the Generic OAuth plugin for passing additional custom parameters such as this. ### Describe the solution you'd like I would like to see support added to the Generic OAuth plugin for passing additional custom parameters to the OAuth authorization endpoint. This could be defined by adding an `additionalParameters` option to the Generic OAuth plugin configuration. ### Describe alternatives you've considered I'm unable to think of any alternative ways to pass an additional custom parameter. ### Additional context _No response_
GiteaMirror added the locked label 2026-04-13 03:41:45 -05:00
Author
Owner

@jcqvisser commented on GitHub (Dec 31, 2024):

@mpnow This might feel like a workaround, but I expect that adding query-parameters to the authorizationUrl string in your GenericOAuthConfig for Asana would do the trick.

eg:

genericOauth({
  config: [{
    providerId: 'asana',
    authorizationUrl: 'https://app.asana.com/-/oauth_authorize?display_ui=always'
    // the rest of the config...
  }]
})

It seems like the authorizationUrl is used as provided. Extra query-params are added on top of those that are aready there.

Note: Providing a discoveryUrl would override the provided authorizationUrl. If you're using the discoveryUrl option atm you should probably switch to providing the details manually. (Find them by navigating to the discoveryUrl in a browser: https://app.asana.com/api/1.0/.well-known/openid-configuration)

<!-- gh-comment-id:2566329673 --> @jcqvisser commented on GitHub (Dec 31, 2024): @mpnow This might feel like a workaround, but I expect that adding query-parameters to the `authorizationUrl` string in your `GenericOAuthConfig` for Asana would do the trick. eg: ```ts genericOauth({ config: [{ providerId: 'asana', authorizationUrl: 'https://app.asana.com/-/oauth_authorize?display_ui=always' // the rest of the config... }] }) ``` It seems like the `authorizationUrl` is [used as provided](https://github.com/better-auth/better-auth/blob/88dd9df34960011100a7446c98b37f3d625a409d/packages/better-auth/src/oauth2/create-authorization-url.ts#L25). Extra query-params are added on top of those that are aready there. **Note**: Providing a `discoveryUrl` would [override the provided `authorizationUrl`](https://github.com/better-auth/better-auth/blob/main/packages/better-auth/src/plugins/generic-oauth/index.ts#L354). If you're using the discoveryUrl option atm you should probably switch to providing the details manually. (Find them by navigating to the `discoveryUrl` in a browser: https://app.asana.com/api/1.0/.well-known/openid-configuration)
Author
Owner

@mpnow commented on GitHub (Dec 31, 2024):

Ah of course, @jcqvisser, thanks - not sure why I didn't think to try that. Yes, it worked perfectly. Definitely an acceptable workaround until your PR #1083 is added.

<!-- gh-comment-id:2566483179 --> @mpnow commented on GitHub (Dec 31, 2024): Ah of course, @jcqvisser, thanks - not sure why I didn't think to try that. Yes, it worked perfectly. Definitely an acceptable workaround until your PR #1083 is added.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#8576