obabichev / react-token-auth

84 stars 22 forks source link

Auto refresh with authFetch and option to auto logout if returning to page and auth token expired #10

Closed Alemkin closed 4 years ago

Alemkin commented 4 years ago

It would make sense that when you call auth Fetch, it will call the update tokens function if it was provided at a set interval, of maybe 5 minutes, or an interval that is provided, so it does it at an acceptable threshold for when the user is interacting with the page.

Also we want the user to be logged out at some point, so I think adding an option to forgo refresh if the auth token is already expired. It only makes sense to refresh if they haven't left the auth token with no activity long enough to expire.

I like the project by the way!