Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add TokenAuthenticator setup #228

Open
luongvo opened this issue May 26, 2022 · 1 comment · May be fixed by #577
Open

Add TokenAuthenticator setup #228

luongvo opened this issue May 26, 2022 · 1 comment · May be fixed by #577

Comments

@luongvo
Copy link
Member

luongvo commented May 26, 2022

Why

Most of the apps use API requests and have a refresh token mechanism to request new access tokens in case they expire. We don't have the setup for the initial TokenAuthenticator yet, so we should add it to our templates.

The initial Authenticator needs to contain:

  • max attempt/retry logic (normally set to 3).
  • make use of synchronized(this) {} when executing the refresh token and rebuild the request to handle multiple authenticator calls at a time.
  • try/catch wrapping to catch errors during token refreshing. The default action in case an error has occurred.

Who Benefits?

Developers who use this template to initialize their project with network requests.

I think this is essential because most of apps have API request and have refresh token mechanism. Having a standard setup would help us a lot in development and reduce mistakes.

Example of implementation: https://github.com/nimblehq/toyota-wallet-android/blob/main/data/src/main/java/co/omise/gcpf/service/authenticator/ApplicationRequestAuthenticator.kt

@toby-thanathip toby-thanathip added this to the 3.13.0 milestone Aug 2, 2022
@ryan-conway ryan-conway modified the milestones: 3.13.0, 3.14.0 Sep 30, 2022
@doannimble doannimble self-assigned this Oct 4, 2022
@toby-thanathip toby-thanathip removed this from the 3.14.0 milestone Oct 21, 2022
@toby-thanathip toby-thanathip modified the milestone: 3.15.0 Dec 1, 2022
@toby-thanathip toby-thanathip added this to the 3.16.0 milestone Dec 26, 2022
@toby-thanathip toby-thanathip modified the milestones: 3.16.0, 3.17.0 Jan 24, 2023
@luongvo
Copy link
Member Author

luongvo commented May 28, 2024

@hoangnguyen92dn @ryan-conway @nimblehq/chapter-android According to some edge cases we have faced and resolved in the recent projects regarding the refresh-token mechanism, this task should be in a higher priority to prepare the stable implementation for the following projects.

@kaungkhantsoe kaungkhantsoe linked a pull request May 28, 2024 that will close this issue
kaungkhantsoe added a commit that referenced this issue May 30, 2024
kaungkhantsoe added a commit that referenced this issue May 30, 2024
@kaungkhantsoe kaungkhantsoe linked a pull request Jun 6, 2024 that will close this issue
@ryan-conway ryan-conway modified the milestones: 3.29.0, 3.30.0 Aug 1, 2024
@ryan-conway ryan-conway modified the milestones: 3.30.0, 3.31.0 Nov 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment