0
0
Firebasecloud~10 mins

Phone number authentication in Firebase - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to initialize Firebase phone authentication.

Firebase
const auth = firebase.auth();
auth.[1]('+1234567890')
Drag options to blanks, or click blank then click option'
AsignOut
BcreateUserWithEmailAndPassword
CsignInWithPhoneNumber
DsignInWithEmailAndPassword
Attempts:
3 left
💡 Hint
Common Mistakes
Using email authentication methods instead of phone number methods.
Trying to sign out instead of signing in.
2fill in blank
medium

Complete the code to confirm the verification code received by the user.

Firebase
confirmationResult.[1](code).then((result) => {
  const user = result.user;
});
Drag options to blanks, or click blank then click option'
Aconfirm
BverifyCode
CsignIn
DsendVerificationCode
Attempts:
3 left
💡 Hint
Common Mistakes
Using incorrect method names like sendVerificationCode or verifyCode.
Trying to sign in directly without confirming the code.
3fill in blank
hard

Fix the error in the code to set up reCAPTCHA verifier for phone authentication.

Firebase
window.recaptchaVerifier = new firebase.auth.[1]('recaptcha-container');
Drag options to blanks, or click blank then click option'
ARecaptchaVerifierWidget
BRecaptchaVerifier
CRecaptchaVerifierInstance
DRecaptchaVerifierAuth
Attempts:
3 left
💡 Hint
Common Mistakes
Using incorrect class names that do not exist in Firebase.
Misspelling the class name.
4fill in blank
hard

Fill both blanks to create a phone auth provider and send a verification code.

Firebase
const phoneProvider = new firebase.auth.[1]();
firebase.auth().[2]('+1234567890');
Drag options to blanks, or click blank then click option'
APhoneAuthProvider
BsignInWithPhoneNumber
CverifyPhoneNumber
DsendVerificationCode
Attempts:
3 left
💡 Hint
Common Mistakes
Using method names that do not exist on PhoneAuthProvider.
Confusing provider class with authentication methods.
5fill in blank
hard

Fill all three blanks to handle phone number sign-in with reCAPTCHA verifier.

Firebase
window.recaptchaVerifier = new firebase.auth.[1]('recaptcha-container');
const phoneNumber = '+1234567890';
const appVerifier = window.[2];
firebase.auth().[3](phoneNumber, appVerifier)
  .then((confirmationResult) => {
    window.confirmationResult = confirmationResult;
  });
Drag options to blanks, or click blank then click option'
ARecaptchaVerifier
BrecaptchaVerifier
CsignInWithPhoneNumber
DverifyPhoneNumber
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong class or variable names for reCAPTCHA verifier.
Calling incorrect methods for phone sign-in.