title: Log out user after inactivity with JWT Access and Refresh tokens
body: <p>I implement autentication mechanism in web application with Angular 2. </p>
  
  <p>I going to use JSON Web Token. Two types of token, Access token (short-lived) and Refresh token (long-lived) which are described here: <a href="https://auth0.com/blog/refresh-tokens-what-are-they-and-when-to-use-them/" rel="nofollow noreferrer">https://auth0.com/blog/refresh-tokens-what-are-they-and-when-to-use-them/</a></p>
  
  <p>I <strong>want to obtain</strong> result which is common when session/cookies are used. <strong>After a period time of user inactivity, the user is logged out</strong>. Which basiclly means that the browser displays the login page and in case of using JWT, the tokens are removed from browser localStorage or storage cookies. </p>
  
  <p>I do not see the way how to do this, relaing only on Access and Refresh tokens. </p>
  
  <p>When Access token is expired (eg. each 10 minutes), the new one is requested using Refresh token (which expires each 8 hours). But what when the user is inactive for eg. 1 hour? Refresh token is still valid so next user interaction will cause obtain new Access token and the user sill can use th app.</p>
  
  <p>Maybe there are some Angular2 or JavaScript mechanisms which in case of user inactivity, perform some action or redirect to login page?</p>