OpenAPITools / OpenAPITools/openapi-generator
[REQ] Examples of using Basic Auth (api key and username and password) and OAuth for kotlin clients
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.
I am using openapi-generator to generate a sdk library for my REST API.
The API has basic auth setup on all its endpoints. Unfortunately, in the code that is generated I cannot see any way to pass necessary header values as the methods accept only parameters that were defined explicitly in openapi specification in the request section.
Pet store auth has oauth2 setup as well but again in the generated code I do not see any way to use it OOTB with the generated methods.
Describe the solution you'd like
I am not sure if this is how the OpenAPI works but I think I should not have to specify the api key parameter explicitly in the request params section to get it in a method signature to use (as it is done in the pet example for deletePet operation).
When apikey or username/password auth is configured I think the parameters should pop in the method signature automatically.
Describe alternatives you've considered
The only alternative I can think of is to update the code after generation which I am trying to avoid as much as possible.
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
The issue mentions generated Kotlin client methods and the Pet Store deletePet operation, but names no source files or tests. Start by examining how Basic Auth, API keys, username/password, and OAuth are represented in the generated client and compare that with deletePet. Done means documented examples show these authentication schemes working without manually adding auth parameters to each operation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- kotlin, openapi
- Domain
- api, authentication
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100