0
0
Firebasecloud~20 mins

Anonymous authentication in Firebase - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Anonymous Authentication Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
service_behavior
intermediate
2:00remaining
What happens after anonymous sign-in in Firebase?
When a user signs in anonymously using Firebase Authentication, what is the state of the user's identity immediately after sign-in?
Firebase
firebase.auth().signInAnonymously().then(userCredential => {
  console.log(userCredential.user.uid);
});
AThe user is signed out immediately after sign-in.
BThe user has a unique user ID but no email or password associated.
CThe user is signed in with a Google account by default.
DThe user is signed in with a temporary email and password.
Attempts:
2 left
💡 Hint
Think about what anonymous means in authentication.
security
intermediate
2:00remaining
What is a security risk of anonymous authentication?
Which of the following is a potential security risk when using Firebase anonymous authentication in an app?
AAnonymous authentication requires users to enter a password.
BAnonymous users can access admin-only data by default.
CUsers can lose their data if they uninstall the app without linking their account.
DAnonymous users are automatically upgraded to full accounts.
Attempts:
2 left
💡 Hint
Consider what happens if the anonymous user identity is lost.
Configuration
advanced
2:00remaining
Which Firebase rule allows anonymous users to read data but not write?
Given Firebase Realtime Database rules, which rule snippet correctly allows anonymous users to read data but prevents them from writing?
A
{
  "rules": {
    ".read": "auth != null",
    ".write": "auth != null && auth.isAnonymous == false"
  }
}
B
{
  "rules": {
    ".read": "auth != null && auth.isAnonymous == true",
    ".write": "auth != null"
  }
}
C
{
  "rules": {
    ".read": "auth == null",
    ".write": "auth == null"
  }
}
D
{
  "rules": {
    ".read": "true",
    ".write": "false"
  }
}
Attempts:
2 left
💡 Hint
Check the conditions for read and write permissions based on auth state.
Architecture
advanced
2:00remaining
How to preserve user data when upgrading anonymous users?
What is the recommended approach to keep user data when an anonymous Firebase user upgrades to a permanent account?
ASign out the anonymous user and sign in with the new account without linking.
BCreate a new user and manually copy data from the anonymous user ID to the new user ID.
CDelete the anonymous user and create a new permanent user without data migration.
DLink the anonymous user credential to the new permanent credential using linkWithCredential().
Attempts:
2 left
💡 Hint
Think about how Firebase supports account linking.
🧠 Conceptual
expert
2:00remaining
What is the behavior of Firebase anonymous authentication token expiration?
Which statement correctly describes the token expiration behavior for Firebase anonymous authentication users?
AAnonymous user tokens expire after one hour and are automatically refreshed by the SDK.
BAnonymous user tokens expire immediately after sign-in.
CAnonymous user tokens expire after 24 hours and require manual refresh by the developer.
DAnonymous user tokens never expire and do not require refresh.
Attempts:
2 left
💡 Hint
Consider how Firebase handles token lifecycle for all users.