0
0
Firebasecloud~10 mins

User profile data 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 get the current user's UID.

Firebase
const userId = firebase.auth().currentUser.[1];
Drag options to blanks, or click blank then click option'
AdisplayName
Bemail
Cuid
DphoneNumber
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'email' instead of 'uid' will not give the unique user ID.
Trying to access 'displayName' when you want the user ID.
2fill in blank
medium

Complete the code to update the user's display name in their profile.

Firebase
firebase.auth().currentUser.updateProfile({ displayName: [1] });
Drag options to blanks, or click blank then click option'
A'user123'
BdisplayName
CuserName
D'New Name'
Attempts:
3 left
💡 Hint
Common Mistakes
Passing a variable without quotes when a string is expected.
Using the property name instead of a string value.
3fill in blank
hard

Fix the error in the code to correctly fetch the user's email.

Firebase
const email = firebase.auth().currentUser.[1];
Drag options to blanks, or click blank then click option'
Aemail
Bmail
CuserEmail
DemailAddress
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'emailAddress' or 'userEmail' which are not valid properties.
Trying to access 'mail' which does not exist.
4fill in blank
hard

Fill both blanks to set the user's photo URL and then reload the user data.

Firebase
firebase.auth().currentUser.updateProfile({ photoURL: [1] }).then(() => { return firebase.auth().currentUser.[2](); });
Drag options to blanks, or click blank then click option'
A'https://example.com/photo.jpg'
Breload
Crefresh
Dupdate
Attempts:
3 left
💡 Hint
Common Mistakes
Using a method name instead of a string for photoURL.
Calling a non-existent method like 'refresh' or 'update' instead of 'reload'.
5fill in blank
hard

Fill all three blanks to create a user profile object with UID, email, and display name.

Firebase
const profile = { id: [1], email: [2], name: [3] };
Drag options to blanks, or click blank then click option'
Afirebase.auth().currentUser.uid
Bfirebase.auth().currentUser.email
Cfirebase.auth().currentUser.displayName
Dfirebase.auth().currentUser.phoneNumber
Attempts:
3 left
💡 Hint
Common Mistakes
Using phoneNumber instead of displayName for the name field.
Mixing up email and uid properties.