OpenAPITools / OpenAPITools/openapi-generator

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

Open
#17,047 1 comment 7 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Enhancement: Feature
Dominant language
Java
Stars
26.8k
Forks
7.7k
PR merge metrics
PR metrics pending

Description

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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the C# Configuration class and OAuthAuthenticator.cs, focusing on the GetToken() method and how the OAuth token request is assembled. Add the requested optional scope configuration and verify that the request includes scope only when specified; confirm the existing client-credentials flow remains unchanged without it.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
api, authentication
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.