intuit / oauth-jsclient

Intuit's NodeJS OAuth client provides a set of methods to make it easier to work with OAuth2.0 and Open ID
https://developer.intuit.com/
Apache License 2.0
121 stars 156 forks source link

Adding AutoRefresh for token refresh #56

Closed sthang closed 4 years ago

coveralls commented 4 years ago

Coverage Status

Coverage increased (+0.006%) to 88.068% when pulling f5ca941892f4658545ed7763e854f50e48a90cb0 on sthang:develop into 6352c7589fef9d94aa0c4ca5b9b04c21b2066675 on intuit:autoRefresh.

abisalehalliprasan commented 4 years ago

@sthang : Thanks for the PR 👏 . Have a couple of questions with your implementation :

sthang commented 4 years ago

@abisalehalliprasan : Thanks for the review.

  1. No. If refresh is called explicitly it will be independent of the autoRefresh and has no impact on the timer. I thought about it and made it independent to keep the implementation simple. The alternative is to reset the timer on setInterval when refresh is called outside of autoRefresh. What do you think?

  2. Here's the stopRefresh on the OAuthClient. The sample app is calling it on the oauthClient.

abisalehalliprasan commented 4 years ago

@sthang :

1.) We do not want the explicit token refresh call to coincide with the autoRefresh. The workaround seems fine but there is a one-off edge case where the two API calls might coincide(the probability is very low 😃). I will see if I could implement Queue logic here.

Could you close this PR and create a PR for the branch autoRefresh . Apologize for the re-do, I need to test this feature before actually releasing it. Thanks @sthang

sthang commented 4 years ago

No problem. I've updated the Pull request base to autoRefresh.