0
0
Firebasecloud~10 mins

Email/password signup 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 Authentication.

Firebase
const auth = [1](app);
Drag options to blanks, or click blank then click option'
AsignInWithEmailAndPassword
BcreateUserWithEmailAndPassword
CinitializeApp
DgetAuth
Attempts:
3 left
💡 Hint
Common Mistakes
Using user creation or sign-in functions instead of initializing auth.
Trying to initialize Firebase app instead of auth.
2fill in blank
medium

Complete the code to create a new user with email and password.

Firebase
firebase.auth().[1](email, password).then(userCredential => { console.log('User created'); });
Drag options to blanks, or click blank then click option'
AcreateUserWithEmailAndPassword
BsignInWithEmailAndPassword
CsendPasswordResetEmail
DsignOut
Attempts:
3 left
💡 Hint
Common Mistakes
Using sign-in method instead of user creation.
Trying to reset password instead of creating user.
3fill in blank
hard

Fix the error in the code to handle signup errors correctly.

Firebase
firebase.auth().createUserWithEmailAndPassword(email, password).catch(error => { console.error([1]); });
Drag options to blanks, or click blank then click option'
Aerror.message
Berror
Cerror.code
Derror.details
Attempts:
3 left
💡 Hint
Common Mistakes
Logging the whole error object instead of the message.
Using a non-existent property like error.details.
4fill in blank
hard

Fill both blanks to import and initialize Firebase app correctly.

Firebase
import { [1] } from 'firebase/app';
const app = [2](firebaseConfig);
Drag options to blanks, or click blank then click option'
AinitializeApp
BgetAuth
DfirebaseConfig
Attempts:
3 left
💡 Hint
Common Mistakes
Importing getAuth instead of initializeApp.
Using firebaseConfig as a function.
5fill in blank
hard

Fill all three blanks to sign up a user and handle success and error.

Firebase
firebase.auth().[1](email, password)
  .then(userCredential => {
    console.log('User ID:', userCredential.user.[2]);
  })
  .catch(error => {
    console.error('Error:', error.[3]);
  });
Drag options to blanks, or click blank then click option'
AcreateUserWithEmailAndPassword
Buid
Cmessage
DsignInWithEmailAndPassword
Attempts:
3 left
💡 Hint
Common Mistakes
Using sign-in method instead of create user.
Logging error code instead of message.
Accessing wrong user property.