Search code examples
iosobjective-cfirebasefirebase-security

List of Authorisation errors with Firebase login


What I need is a complete list of FirebaseAuthentication codes for all the different login errors and also a list of all those errors. So far I have found some by trial and error but can't take the risk I have missed some.

I am using the Firebase simple login to log in with email/password, facebook, twitter and also anonymous logins. Obviously with this many login methods there are lots of ways the user can fail to login correctly (incorrect email format, didn't enter a password etc). Currently I am using this code:

... authenticateWithDictionary method

completion:^(NSError * error, id<PUser> user) {

    if (!error) {

        [self loginButtonPressed:Nil];
    }
    else {

        [UIView alertWithTitle:bErrorTitle withError:error];
    }

The only issue with this is I end my getting errors raised which read like this:

**(Error Code: EMAIL_TAKEN) The specified email address is already in use.**

This is fine to let me know what has gone wrong in testing but once the app goes live I will want individual messages to a) look tidier b) let the user know why they have got this error

So far through trial and error I have figured out the following:

error code

-5      INVALID EMAIL - empty or incorrect format
-6      INVALID PASSWORD
-9      EMAIL TAKEN

Once I have a complete list I am going to use a switch statement to get them all being dealt with correctly

Does anyone know the comprehensive list of error codes and errors so that I can take them all into account without having to think through all the options which might mean I miss one


Solution

  • Here's the full list of error codes from the Firebase website:

    https://www.firebase.com/docs/web/guide/user-auth.html#section-full-error