title: Test if there is a pending firebase authentication
body: <p><strong>Update:</strong> Due to code refactor, the need for testing that has gone away, and as Ron pointed out in the accepted answer, <code>onAuthStateChange()</code> will fire eventually, and the app can rely on that. I wasn't originally seeing that, which is what motivated my question.</p>
  
  <p><strong>Original Question:</strong> I've been using <code>window.localStorage</code> and searching for a key that starts with <code>'firebase:authUser'</code> as a way to determine if my app can expect a firebase authentication event any time soon. Whether it succeeds or fails,  <code>firebase.auth().onAuthStateChanged()</code> is triggered, and I can deal with the result there. The reason for wanting to know is that if I <em>have</em> some local credentials which are being processed, my app can display a 'Please wait...' type message. But if there are none, it can redirect immediately to the login page. Since firebase moved to <code>indexedDB</code>, this code no longer works, and I couldn't find any equivalent hack to look for locally persisted credentials (maybe it's not possible now?).</p>
  
  <p>I'd also be happy to switch to <code>SESSION</code> persistence rather than <code>LOCAL</code>, but I'm not sure if this changes the scenario at all—I'd still need a way to test if there was anything happening to avoid the user being stuck at the 'Please wait...' message forever if there were no local credentials to validate.</p>
  
  <p>Or am I doing this wrong? I know I could show the login page <em>until</em> <code>firebase.auth().onAuthStateChanged()</code> fires, but by then the user might have clicked, and the experience isn't that great either if they already signed in and then refresh the page, where they see the login page <em>again</em> until everything is loaded.</p>
  
  <p>I couldn't find anything in the <code>auth()</code> API to tell if it was in the process of dealing with locally persisted credentials, and up until now, the <code>window.localStorage</code> hack has been working very well. What's the best way to manage the user experience now?</p>