I cannot seem to find this answer anywhere. When randomly authenticating a user with base.auth().signInAnonymously()
, and then calling currentUser()
, will it return that anonymous user?
Basically, I am trying to figure out if a user is actually logged in, or if they are anonymously authenticated. Please help.
"Yes, it will", like Frank van Puffelen said. You could get the user:
private lateinit var auth: FirebaseAuth
...
auth = Firebase.auth
val currentUser = auth.currentUser
and if the currentUser exists, you can find out if it is anonymous by using the isAnonymous
field:
if (user?.isAnonymous) {
// Do something
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With