badgateway / oauth2-client

OAuth2 client for Node and browsers
https://www.npmjs.com/package/@badgateway/oauth2-client
MIT License
273 stars 32 forks source link

Add option to disable scheduled refresh #51

Closed bradjones1 closed 1 year ago

bradjones1 commented 2 years ago

Thanks for this excellent little library.

I am using this in a React Native project, and setTimeout() isn't really advisable in that context/doesn't make as much sense as it may in say, a browser. See https://github.com/facebook/react-native/issues/12981#issuecomment-652745831 for further.

This PR adds a configuration option to disable scheduling a refresh.

I am not a JavaScript developer and this is literally the first TypeScript I've written, so please be gentle. I've tested locally but I am only running in the context of tokens obtained outside of this middleware... so take a close look in review.