OpenAPITools / openapi-generator

OpenAPI Generator allows generation of API client libraries (SDK generation), server stubs, documentation and configuration automatically given an OpenAPI Spec (v2, v3)
https://openapi-generator.tech
Apache License 2.0
21.15k stars 6.41k forks source link

[REQ] [csharp] Option to specify scopes when using OAuth Client Credentials flow #17047

Open sgafoor195 opened 9 months ago

sgafoor195 commented 9 months ago

Is your feature request related to a problem? Please describe.

When using the OAuth client credentials flow, the Configuration object allows me to specify the OAuthTokenUrl, OAuthClientId, and OAuthClientSecret, but there seems to be no way to specify any scope. Problem I'm facing is that I need to specify a scope to retrieve a token, so currently the request made in the OAuthAuthenticator.cs (GetToken() method) class returns a 400 response.

Describe the solution you'd like

  1. An additional property in the Configuration class for specifying an OAuth scope
  2. The GetToken() method in OAuthAuthenticator.cs adds a scope parameter when making the request (if a scope has been specified)

Describe alternatives you've considered

Current workaround I'm attempting is adding custom code to override the AccessToken token property.

mjansrud commented 1 month ago

Any plan to implement this feature @OpenAPITools/generator-core-team / @wing328 ?