Complete the code to initialize the Facebook auth provider.
const provider = new firebase.auth.[1]();The Facebook sign-in requires using FacebookAuthProvider from Firebase Auth.
Complete the code to trigger the Facebook sign-in popup.
firebase.auth().signInWith[1](provider).then(result => {
// handle result
});To open a popup for sign-in, use signInWithPopup method.
Fix the error in the code to get the Facebook access token from the result.
const credential = result.credential;
const token = credential.[1];The Facebook access token is available as accessToken on the credential object.
Fill both blanks to handle sign-in errors and get the error message.
firebase.auth().signInWithPopup(provider).catch(error => {
const errorCode = error.[1];
const errorMessage = error.[2];
console.error(errorCode, errorMessage);
});Firebase errors have code and message properties for details.
Fill all three blanks to extract user info after Facebook sign-in.
firebase.auth().signInWithPopup(provider).then(result => {
const user = result.[1];
const name = user.[2];
const email = user.[3];
console.log(`User: ${name}, Email: ${email}`);
});The signed-in user info is in result.user. The user's name is displayName and email is email.
