简体   繁体   English

如何使用 firebaseAuth 从 firebase 获取当前活动的 android 应用程序用户 email

[英]how to get current active android app user email from firebase using firebaseAuth

My app have two user( buyer and seller).我的应用程序有两个用户(买家和卖家)。 I am tring to get current user email which is buyers but when i run the below code, it shows previously logged in user email which is the seller's one.我正在尝试获取当前用户 email ,它是买家,但是当我运行以下代码时,它显示之前登录的用户 email 是卖家的用户。

        String userID= FirebaseAuth.getInstance().getCurrentUser().getEmail();

How to write firebase code to get current active user email.如何编写 firebase 代码以获取当前活跃用户 email。

When you go to the Auth > Sign-In Methods page of your project in the Firebase console.当您 go 到 Firebase 控制台中项目的 Auth > 登录方法页面时。 do you have One account per email address on or off?每个 email 地址是否打开或关闭一个帐户? If you allow multiple accounts per email address, you will get null for FirebaseUser.getEmail()如果您允许每个 email 地址有多个帐户,您将获得FirebaseUser.getEmail()的 null

Use this code snippet FirebaseAuth.getInstance().signOut();使用此代码段FirebaseAuth.getInstance().signOut(); to sign out the current user properly, after successfully signed out you can repopulate your user model from Firebase Auth/login in new user .要正确sign out当前用户,成功注销后,您可以从 Firebase Auth/login in new user重新填充您的user model Hope your problem will be solved with this.希望您的问题将通过此解决。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何通过具有电子邮件登录功能的FirebaseAuth获取登录Android应用的电子邮件帐户用户的照片url - how to get photo url of email account user signed into android app through FirebaseAuth with Email signIn Firebase / Android:获取当前用户电子邮件 - Firebase/Android: Get current user email Android:如何使用 FirebaseAuth 从 Facebook 获取更大的个人资料图片? - Android : How to get larger profile pic from Facebook using FirebaseAuth? 如何从Android中的Twitter获取当前登录用户的电子邮件 - How to get the email of current logged in user from twitter in android 如何通过用户电子邮件 Firebase android 获取用户 ID? - How to get userID by user Email Firebase android? 如何使用 Flutter 从 Firebase 获取当前活跃用户? - How I can get current active users from Firebase with Flutter? 如何从 Firebase 电子邮件身份验证中获取电子邮件的用户 ID - How to get the user id of a email from firebase email authentication 从 Uid 获取用户电子邮件,无需登录应用 Firebase - Get User Email From Uid Without Login to app Firebase 如何检查用户是否在 android 应用程序(Firebase)中输入了有效的 email 地址? - How to check if the user entered a valid email address in an android app (Firebase)? 如何使用 FirebaseAuth 从 Google 提供商处获取性别和生日? - How to get gender and birthday from Google provider using FirebaseAuth?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM