Firebase Authentication not persisting

前端 未结 1 1668
误落风尘
误落风尘 2021-01-04 20:37

Authentication doesn\'t seem to persist after page has been refreshed. Even after using firebase.auth.Auth.Persistence.LOCAL.

Whenever I log into my app

相关标签:
1条回答
  • 2021-01-04 21:21

    You need to use onAuthStateChanged listener to detect the initial auth state:

    firebase.auth().onAuthStateChanged(user => {
      if (user) {
        // User is signed in.
      } else {
        // User is signed out.
      }
    });
    
    0 讨论(0)
提交回复
热议问题