swagger-api / swagger-api/swagger-codegen

[okhttp-gson] Add Support for OAuth Access Token Retry

Open
#8,698 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Mustache
Stars
17.8k
Forks
6k
PR merge metrics
No merged PRs in 30d

Description

Description

The OkHttp-gson Java library does not currently have support for automatic OAuth access token retry. This is a problem for developers using generated SDKs as they have to re-implement token retry logic manually for every SDK. Other libraries, such as volley, retrofit, and retrofit2, already have this functionality built-in. I would like to have this for okhttp-gson as well, using a similar approach.

Swagger-codegen version

2.2.X and 2.3.X

Swagger declaration file content or url

N/A

Command line used for generation

java -jar swagger-codegen-cli.jar io.swagger.codegen.SwaggerCodegen generate -i ./build/spec.yaml -l swagger -l java -c ./config/sdk-java-config.json -o ./generated-sdk-java

Steps to reproduce

N/A

Related issues/PRs
Suggest a fix/enhancement

I plan on submitting a PR myself by implementing a solution similar to the one used in the retrofit library: https://github.com/swagger-api/swagger-codegen/commit/69d956f16b6c18d6282b5bd0d408505cf1adb56a

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 okhttp-gson Java library generated by the documented swagger-codegen command, then compare the proposed approach with the referenced retrofit commit. Define the OAuth access-token retry behavior and verify that generated SDK users no longer need to re-implement token retry logic manually.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
api, authentication
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.