OpenAPITools / OpenAPITools/openapi-generator
[REQ] [csharp] Option to specify scopes when using OAuth Client Credentials flow
Nobody has claimed this yet.
- 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
- An additional property in the
Configurationclass for specifying an OAuth scope - The
GetToken()method inOAuthAuthenticator.csadds ascopeparameter 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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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