title: Persisted sign in with Firebase Javascript SDK
body: <p>I am using Firebase npm package (version 5.2.0) for client side authentication and database.</p>
  
  <p>For some reason even when I set persistence to <strong>LOCAL</strong>, each refresh <strong>the current user is null</strong>.</p>
  
  <p>Signing in: </p>
  
  <pre><code>export const login = (email, password) =&gt; {
      return firebase.auth().setPersistence(firebase.auth.Auth.Persistence.LOCAL)
          .then(() =&gt; {
              return firebase.auth().signInWithEmailAndPassword(email, password);
          })
  }
  </code></pre>
  
  <p>Getting current user: </p>
  
  <pre><code>export const currentUser = () =&gt; {
       return firebase.auth().currentUser;
  }
  </code></pre>
  
  <p>Another oddity is when I apply database rules while using persistence. I get a permission error. The error disappears if the rules are set to public read/write. Does the persistence mechanism need access to the database?</p>
  
  <p><a href="https://i.stack.imgur.com/dqEGS.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/dqEGS.png" alt="Firebase error"></a></p>
  
  <p>Am I doing something wrong?</p>