Issue
I am trying to add anonymous authentication to my app using Firebase. But this error keeps happening:
alt="enter image description here" />
This is my code:
firebaseAuth.signInAnonymously()
.addOnCompleteListener(task -> {
if (task.isSuccessful()) {
// Sign in success, update UI with the signed-in user's information
FirebaseUser user = firebaseAuth.getCurrentUser();
updateUI(user);
} else {
// If sign in fails, display a message to the user.
Toast.makeText(AnonymousLoginActivity.this, task.getException().getMessage(),
Toast.LENGTH_SHORT).show();
updateUI(null);
}
});
How can I fix this?
Solution
Enable Anonymous login in Firebase.
Head to Firebase console and toggle the switch for Anonymous login.
Answered By - avs
Answer Checked By - David Marino (JavaFixing Volunteer)