I logged in as Anonymous user. See my Firebase console screenshot:
But when I checked by printing the status like this:
print('Is Anonymous:
${FirebaseAuth.instance.currentUser.isAnonymous}. UID: ${FirebaseAuth.instance.currentUser.uid}');
This is what I got in debug console:
I/flutter (12139): Is Anonymous: false. UID: O75s04Y3voRTdqaUJJ5gdyinQSB3
How can it be? Is there anyone ever had this kind of problem and solved it?
I usually check the user.providerData
to determine if the user is associated with any providers. If not, I consider it anonymous.
In another app I only care about Google sign-in, and use this:
bool isSignedInUser() {
return this.user != null && (
this.user.providerData.any((UserInfo info) => info.providerId == "google.com")
);
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.