googleapis / googleapis/google-oauth-java-client

StoredCredential / AbstractDataStoreFactory - optimistic lock

Open
#401 0 comments 0 reactions 0 assignees View on GitHub
type: feature request
Dominant language
Java
Stars
661
Forks
284
PR merge metrics
No merged PRs in 30d

Description

**Is your feature request related to a problem? Please describe.**

I'm facing to a **concurrent requests** that for the same user need to refresh the access token. All is good for the first request, but the second that uses the same refresh token has been rejected and in consequence, write null in the database. The access token and the new refresh are lost.

**Describe the solution you'd like**
Add a version field to the StoredCredential object. At this time this object cannot be overridden because it is declared as final class. This new field permit to implement a optimistic lock in my DataStoreFactory.
Result:
The second request it want to insert null with version 1, will be rejected because in database the first request put the new token with version 2. The right access token and refresh token aren't lost.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.