Error Handling
Notice
This page is archived and might not reflect the latest version of the FlutterFire plugins. You can find the latest information on firebase.google.com:
The Firebase Authentication SDKs provide a simple way for catching the various errors which may occur which using
authentication methods. The SDKs for Flutter expose these errors via the FirebaseAuthException
class.
At a minimum, a code
and message
are provided, however in some cases additional properties such as an email address
and credential are also provided. For example, if the user is attempting to sign in with an email and password,
any errors thrown can be explicitly caught:
Each method provides various error codes and messages depending on the type of authentication invocation type. The Reference API provides up-to-date details on the errors for each method.
Other errors such as too-many-requests
or operation-not-allowed
may be thrown if you reach the Firebase Authentication quota,
or have not enabled a specific auth provider.
account-exists-with-different-credential
Errors#
Handling If you enabled the One account per email address setting in the Firebase console,
when a user tries to sign in a to a provider (such as Google) with an email that already exists for another Firebase user's provider
(such as Facebook), the error auth/account-exists-with-different-credential
is thrown along with an AuthCredential
class (Google ID token).
To complete the sign-in flow to the intended provider, the user has to first sign in to the existing provider (e.g. Facebook) and then link to the former
AuthCredential
(Google ID token).