Find whether email and username already exist in Firebase Auth in Flutter App

泄露秘密 提交于 2020-01-06 03:21:48

问题


I am using sign up with email in my Flutter app and using Firebase Authentication for the same. How do I show on the sign up page whether the entered email and username already exist in the database?


回答1:


firebase will return that info as an error message:

FirebaseAuth.instance.createUserWithEmailAndPassword(email: _email, password: _password).then((user) {

    // do whatever you want to do with new user object

  }).catchError((e) {
    print(e.details); // code, message, details
  });

if the email exists it'll trigger the catchError. it's worth noting that 'details' is the human readable error getter. 'code' and 'message' are useless to an end user, but those are the only two documented on firebase_auth.



来源:https://stackoverflow.com/questions/51387031/find-whether-email-and-username-already-exist-in-firebase-auth-in-flutter-app

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!