Closed ronderksen closed 4 years ago
This looks great. How does it test?
I had to make some changes to the original setup, but it now refreshes the token automatically, if the AuthService is initiated with autoRefresh: true
. There's also an option to give an amount of slack to the timeout, so that if the OAuth server returns an expires_in of X, then the timeout is triggered at X-refreshSlack (to make sure you get a token before the previous token expires).
I can add some unit tests sometime later this week, if you want.
Thanks for merging! Can you create a new npm version?
New npm version posted: 1.0.5
I'm working on a project where the oauth server returns a refresh_token and expires_in time. With this PR, a timeout is set when the original token is set. I still have to test it to make sure this works as expected, but I wanted to open a draft PR for early feedback :).