Complete the code to sign in a user with email and password.
firebase.auth().signInWithEmailAndPassword(email, [1])The signInWithEmailAndPassword method requires the user's email and password to authenticate the session.
Complete the code to check if a user is currently signed in.
const user = firebase.auth().[1];The currentUser property returns the currently signed-in user or null if no user is signed in.
Fix the error in the code to sign out the current user.
firebase.auth().[1]();The correct method to sign out a user in Firebase is signOut().
Fill both blanks to listen for changes in the user's authentication state.
firebase.auth().[1]((user) => { if (user) { console.log('User is signed in:', [2]); } else { console.log('No user signed in'); } });
The onAuthStateChanged method listens for changes in authentication state. The callback receives the user object when signed in.
Fill all three blanks to refresh the user's ID token.
firebase.auth().currentUser.[1]().then(([2]) => { console.log('New token:', [3]); });
The getIdToken() method refreshes the user's ID token. The token is received in the callback parameter and logged.