0
0
Firebasecloud~20 mins

User profile data in Firebase - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
User Profile Data Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
service_behavior
intermediate
2:00remaining
How does Firebase Authentication handle user profile updates?

When a user updates their profile information using Firebase Authentication's updateProfile method, what happens to the stored user data?

AThe profile data update triggers a full user account deletion and recreation.
BThe profile data is updated on Firebase servers and immediately reflected in the user's authentication token.
CThe profile data is updated on Firebase servers but requires the user to sign out and sign in again to see changes.
DThe profile data is updated only locally on the client and not saved to Firebase servers.
Attempts:
2 left
💡 Hint

Think about how Firebase keeps user data consistent across sessions.

Architecture
intermediate
2:00remaining
Best practice for storing user profile data in Firebase

Which Firebase service is best suited for storing detailed user profile data that can be queried and updated frequently?

AFirebase Cloud Firestore
BFirebase Realtime Database
CFirebase Authentication user profile fields only
DFirebase Cloud Storage
Attempts:
2 left
💡 Hint

Consider which service supports flexible queries and structured data.

security
advanced
2:30remaining
Securing user profile data in Firebase Firestore

Given a Firestore collection 'users' where each document ID matches the user's UID, which security rule correctly restricts read and write access so users can only access their own profile data?

Firebase
rules_version = '2';
service cloud.firestore {
  match /databases/{database}/documents {
    match /users/{userId} {
      allow read, write: if request.auth.uid == userId;
    }
  }
}
Arequest.auth.token.email_verified == true
Brequest.time < timestamp.date(2025, 1, 1)
Crequest.auth.uid != userId
Drequest.auth.uid == userId
Attempts:
2 left
💡 Hint

Think about how to match the authenticated user with the document ID.

Configuration
advanced
2:30remaining
Firebase Cloud Functions to update user profile data

You want to automatically update a user's profile document in Firestore whenever their Firebase Authentication profile changes. Which Cloud Function trigger should you use?

Afunctions.auth.user().onUpdate()
Bfunctions.firestore.document('users/{userId}').onUpdate()
Cfunctions.auth.user().onCreate()
Dfunctions.database.ref('/users/{userId}').onWrite()
Attempts:
2 left
💡 Hint

Consider which event fires when a Firebase Authentication user profile changes.

Best Practice
expert
3:00remaining
Handling user profile data consistency across Firebase Authentication and Firestore

What is the best approach to keep user profile data consistent between Firebase Authentication and Firestore when users update their profile?

AUpdate Firebase Authentication profile only and ignore Firestore data.
BManually update both Firebase Authentication and Firestore profiles on the client side without synchronization.
CUse a Cloud Function triggered on Firebase Authentication user update to sync changes to Firestore.
DUpdate Firestore profile only and do not update Firebase Authentication profile.
Attempts:
2 left
💡 Hint

Think about automating synchronization to avoid data mismatch.