2021年4月23日星期五

Flutter firebase auth throwing platform exception not being caught by try catch

Im running into this issue and im not sure why. I have everything set up on firebase and everything works fine for signup up and signin when you type the username/pass correctly. However, when trying to catch error, im getting a platform exception and its in a wierd form. (This is me trying an incorrect password). As you can see theres a Firebaseauthexception inside a Platform Exception inside a platform exception and my try catch isnt even able to catch it. Im updated to the most recent version of ^1.1.1

PlatformException (PlatformException(firebase_auth, com.google.firebase.auth.FirebaseAuthInvalidCredentialsException: The password is invalid or the user does not have a password., {code: wrong-password, additionalData: {}, message: The password is invalid or the user does not have a password.}, null))  
try {      userCredential = await FirebaseAuth.instance.signInWithEmailAndPassword(email: user, password: pass);    } on FirebaseAuthException catch (e) {      if (e.code == 'user-not-found') {        print('No user found for that email.');      } else if (e.code == 'wrong-password') {        print('Wrong password provided for that user.');      }    }  

UPDATE im also getting this displayed:

Ignoring header X-Firebase-Locale because its value was null.  

UPDATE 2 found this link which describes what im having similarly Google Sign-In With Flutter: Error Code -4

Any insight would be greatly appreciated

https://stackoverflow.com/questions/67219143/flutter-firebase-auth-throwing-platform-exception-not-being-caught-by-try-catch April 23, 2021 at 02:49AM

没有评论:

发表评论