I am trying to add anonymous authentication to my app using Firebase. But this error keeps happening:
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?
CodePudding user response:
Enable Anonymous login in Firebase.