lundi 7 juin 2021

Get currentuser from local with firebase/auth (beta 9)

Firebase/auth currently in version 9 stores by default the session locally inside indexedDB.

Is there a method to access the local current user directly without accessing manually to the indexedDB? something like auth.currentuser?

onAuthStateChanged takes time to get the auth ready when it should be possible to retrieve the "saved current user session".

auth.onAuthStateChanged(function (userData) {
  if (userData) {
    // User is signed in.
  } else {
    // No user is signed in.
  }
});

enter image description here

Aucun commentaire:

Enregistrer un commentaire