gardner / react-oauth2-pkce

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

expires_in stored in localStorage autoRefresh timer every time page reloads #3

Closed gardner closed 4 years ago

gardner commented 4 years ago

Via email:

I'm just looking at the UoA token through react-oauth2-pkce, and it doesn't seem like the token is automatically refreshing.

I've tried setting autoRefresh to true.

From what I can see it seems to store auth in localStorage with the expires_in key, this seems to be a fixed amount and the Auth Service doesn't seem to think it ever needs refreshing, as when you refresh the page it still reads that fixed amount of 3600, so it sets the timer again when you refresh the page for 3600, as it isn't aware of when the timestamp was created from.

I might be wrong, but it'd be good to get some insight from you as the token expiration is only an hour and it'd be good to get the token refreshing.

Cheers