突然间,我得到了这个错误,而做的登录和注册过程。我是在注册界面注册的时候发现的。
bzzcjhmw1#
我在firebase_auth.dart文件中解决了这个问题:
} catch (e) { gmrethrow; }
我把它改成这样:
} catch (e) { rethrow; }
问题就解决了。
xe55xuns2#
您可以这样处理:
@override Future<dynamic> loginWithEmailAndPassword(String email, String password) async { try { await _firebaseAuth.signInWithEmailAndPassword( email: email, password: password); return FirebaseSignInWithEmailResponse(); } catch (exception) { return _mapLoginWithEmailError(exception); } } ApiError _mapLoginWithEmailError(PlatformException error) { final code = error.code; if (code == 'ERROR_INVALID_EMAIL') { return FirebaseSignInWithEmailError( message: 'Your email is not valid. Please enter a valid email', type: FirebaseSignInWithEmailErrorType.INVALID_EMAIL); } else if (code == 'ERROR_WRONG_PASSWORD') { return FirebaseSignInWithEmailError( message: 'Your password is incorrect', type: FirebaseSignInWithEmailErrorType.WRONG_PASSWORD); } else if (code == 'ERROR_USER_NOT_FOUND') { return FirebaseSignInWithEmailError( message: 'You do not have an account. Please Sign Up to' 'proceed', type: FirebaseSignInWithEmailErrorType.USER_NOT_FOUND); } else if (code == 'ERROR_TOO_MANY_REQUESTS') { return FirebaseSignInWithEmailError( message: 'Did you forget your credentials? Reset your password', type: FirebaseSignInWithEmailErrorType.TOO_MANY_REQUESTS); } else if (code == 'ERROR_USER_DISABLED') { return FirebaseSignInWithEmailError( message: 'Your account has been disabled. Please contact support', type: FirebaseSignInWithEmailErrorType.USER_DISABLED); } else if (code == 'ERROR_OPERATION_NOT_ALLOWED') { throw 'Email and Password accounts are disabled. Enable them in the ' 'firebase console?'; } else { return FirebaseSignInWithEmailError( message: 'Make sure you have a stable connection and try again' type: FirebaseSignInWithEmailErrorType.CONNECTIVITY); } }
2条答案
按热度按时间bzzcjhmw1#
我在firebase_auth.dart文件中解决了这个问题:
我把它改成这样:
问题就解决了。
xe55xuns2#
您可以这样处理: