title: Firebase tokens expiration and best practice for handling refresh tokens
body: <p>I am currently using Firebase on a client application (Cordova based mobile app) using the firebase user authentication methods on the client:</p>
  
  <ul>
  <li><strong>signInWithEmailAndPassword</strong></li>
  <li><strong>FacebookAuthProvider</strong></li>
  </ul>
  
  <p>From my current understanding and experience with the sessions expiring: </p>
  
  <p>"<em>Authentication sessions don't expire with Firebase login. But the ID token will have to be refreshed hourly, to keep access to the services.</em>"</p>
  
  <p>I assume this would mean I should just write a background process method that runs every 59 minutes and run the firebase method: </p>
  
  <p><strong>firebase.auth().currentUser.getIdToken(true)</strong> 
  // true indicates according to firebase docs to forceRefresh regardless of the current tokens expiration.</p>
  
  <p>I am just looking to make sure that I have wrapped my head around this.</p>
  
  <p>I'm going with something simple like this... this should probably do the trick: </p>
  
  <pre><code>  let firebaseTokenRefresh = setInterval(function(){
       console.log('running firebase token refresh...');
       // true = forceRefresh
       firebase.auth().currentUser.getIdToken(true); 
    }, 3540000); // 59 minutes firebase token refresh (1 hr expiration)
  </code></pre>
  
  <p>Thanks.</p>