The Firebase Authentication SDKs provided a simple way for catching the various errors which may occur which using
authentication methods. FlutterFire exposes these errors via the
At a minimum, a
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
operation-not-allowed may be thrown if you reach the Firebase Authentication quota,
or have not enabled a specific auth provider.
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).