diff --git a/tools/react/token-provider.jsx b/tools/react/token-provider.jsx index 135e8ff..1a50e94 100644 --- a/tools/react/token-provider.jsx +++ b/tools/react/token-provider.jsx @@ -25,6 +25,11 @@ const TokenProvider = props => { localStorage.setItem("accessToken", accessToken); }, [accessToken]); + //force a logout if refresh token is too old + if (accessToken && (new Date(Date.now() - 60 * 60 * 24 * 30 * 1000).getTime() > decode(accessToken).exp * 1000)) { + forceLogout(); + } + //wrap the default fetch function const tokenFetch = async (url, options) => { //use this?