Short OAuth token lifespan (~ 5 mins) leads to unnecessary fetch of a new token
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 54
- Forks
- 26
- Avg merge
- 2d 7h
- Merged PRs (30d)
- 9
Description
Checklist
- I agree to the terms within the OpenFGA Code of Conduct.
Describe the problem you'd like to have solved
The current implementation of the token validity validation treats tokens that expire in the next 5 minutes as not valid anymore.
Our token lifespan is 5 mins, so with every request to OpenFGA, the client requests a new token.
In my opinion, the 5-minute threshold that the client uses is a very long time. In our microservices environment, we use a 30-second threshold and have never had a problem with it.
Describe the ideal solution
Would it be possible to reduce this threshold or make it configurable? This would allow to continue using very short-lived tokens, which would improve security.
Alternatives and current workarounds
Increase the token lifespan.
References
No response
Additional context
Just as a side note, the default value for token lifespan in Keycloak is 5 minutes.
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 token validity validation in src/main/java/dev/openfga/sdk/api/auth/AccessToken.java, especially lines 30-35. Trace how the five-minute threshold is used when requests obtain tokens, then determine how the chosen or configurable threshold should affect validity; done means short-lived tokens no longer trigger an unnecessary fetch on every request.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- authentication, security
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100