auth() firebase code example

Example 1: how to check the current user in firebase android

@Override
public void onStart() {
    super.onStart();
    FirebaseUser currentUser = mAuth.getCurrentUser();
    if (currentUser == null) {
        // No user is signed in
    } else {
        // User logged in
    }
}

Example 2: firebase auth

dependencies:
  firebase_auth: ^0.18.3+1

Example 3: onstatechange firebase cant get stsTokenManager

firebase.auth().onAuthStateChanged(function(user) {
  if (user) {
    user.getIdToken().then(function(idToken) {
      console.log(idToken);
    });
  }
});

Tags:

Go Example