gardner / react-oauth2-pkce

React auth provider that works with AWS cognito PKCE🛡️🔒
49 stars 57 forks source link

Question on "refreshSlack" #37

Open t-knapp opened 2 years ago

t-knapp commented 2 years ago

Hi,

the optional config parameter refreshSlack provides a number of seconds. This number is added to the expires in timout logic. I'm not sure what time is described by the parameter.

A.) Is it the amount of time in seconds your back-end / server is willing to accept an token that is expired? B.) is it the amount of time in seconds that this library will use to update the token before it expires?

With the default value of 5 seconds, I face some HTTP 401 requests from time to time. The token is refreshed then and HTTP 401 is gone. It seems to me to discribe option A.) but my back-end / server does not accept expired tokens or does not care about slack.

As a workaround I use a negative refreshSlack to avoid random HTTP 401.

Kind regards, Tobias