swagger-api / swagger-api/swagger-codegen
[JAVA] codegen not generating OAuth2 password flow
Nobody has claimed this yet.
- Dominant language
- Mustache
- Stars
- 17.8k
- Forks
- 6k
- PR merge metrics
- No merged PRs in 30d
Description
Description
I used the code generator to create a client library for my API, using an OpenAPI 2.0 Swagger json.
The swagger has both securityDefinitions and security objects specified, but no OAuth token refresh flow was produced. As far as I can tell, the generated APIClient requires a fresh token to be provided externally.
Do I need to manually code the logic for refreshing the OAuth token?
"securityDefinitions": {
"oAuth2Password": {
"type": "oauth2",
"flow": "password",
"tokenUrl": "https://api.buildingos.com/o/token/",
"scopes": {}
},
"security": [
{
"oAuth2Password": []
}
]
Swagger-codegen version
2.3.1
Swagger declaration file content or url
https://gist.github.com/JurisPuchin/7f1e4208dae61bbcb54694b355dd5a38
Command line used for generation
java -jar swagger-codegen-cli-2.3.1.jar generate -i original_raw_oauth_resp3.json -l java -o oath_test8
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
Reproduce the report with swagger-codegen-cli 2.3.1, the linked Swagger declaration, and the shown Java generation command. Inspect the generated APIClient and the Java code-generation templates to determine whether the OAuth2 password flow is represented; done means either generating the expected password-flow handling or documenting that token refresh remains external.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, openapi
- Domain
- api, authentication, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100