首页 文章

Firebase登录的授权错误列表

提问于
浏览
3

我需要的是所有不同登录错误的FirebaseAuthentication代码的完整列表,以及所有这些错误的列表 . 到目前为止,我已经通过反复试验找到了一些,但不能冒风险我错过了一些 .

我使用Firebase简单登录使用电子邮件/密码,facebook,twitter和匿名登录进行登录 . 很明显,有了这么多登录方法,用户可能会有很多方法无法正确登录(电子邮件格式不正确,没有输入密码等) . 目前我正在使用此代码:

... authenticateWithDictionary method

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

    if (!error) {

        [self loginButtonPressed:Nil];
    }
    else {

        [UIView alertWithTitle:bErrorTitle withError:error];
    }

唯一的问题是我结束了我收到的错误,如下所示:

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

这很好,让我知道测试中出了什么问题但是一旦应用程序上线,我会希望个别消息a)看起来更整洁b)让用户知道为什么他们有这个错误

到目前为止,经过反复试验,我发现了以下内容:

错误代码

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

一旦我有一个完整的列表,我将使用switch语句来正确处理它们

有没有人知道错误代码和错误的完整列表,这样我就可以将它们全部考虑在内,而不必考虑所有可能意味着我想念一个的选项

3 回答

  • 0

    以下是Firebase网站的完整错误代码列表:

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

  • 3

    你可以在 FirebaseAuth.frameworkFIRAuthErrorCode 枚举下找到所有firebase auth错误代码和解释

    /*
     Indicates a validation error with the custom token.
     */
    FIRAuthErrorCodeInvalidCustomToken = 17000,
    
    /*
     Indicates the service account and the API key belong to different projects.
     */
    FIRAuthErrorCodeCustomTokenMismatch = 17002,
    
    /*
     Indicates the IDP token or requestUri is invalid.
     */
    FIRAuthErrorCodeInvalidCredential = 17004,
    
    /*
     Indicates the user's account is disabled on the server.
     */
    FIRAuthErrorCodeUserDisabled = 17005,
    
    /*
     Indicates the administrator disabled sign in with the specified identity provider.
     */
    FIRAuthErrorCodeOperationNotAllowed = 17006,
    
    /*
     Indicates the email used to attempt a sign up is already in use.
     */
    FIRAuthErrorCodeEmailAlreadyInUse = 17007,
    
    /*
     Indicates the email is invalid.
     */
    FIRAuthErrorCodeInvalidEmail = 17008,
    
    /*
     Indicates the user attempted sign in with a wrong password.
     */
    FIRAuthErrorCodeWrongPassword = 17009,
    
    /*
     Indicates that too many requests were made to a server method.
     */
    FIRAuthErrorCodeTooManyRequests = 17010,
    
    /*
     Indicates the user account was not found.
     */
    FIRAuthErrorCodeUserNotFound = 17011,
    
    /*
     Indicates account linking is required.
     */
    FIRAuthErrorCodeAccountExistsWithDifferentCredential = 17012,
    
    /*
     Same enum as @c FIRAuthErrorCodeAccountExistsWithDifferentCredential ,
        but with incorrect spelling. Only exists for backwards compatiblity.
     */
    FIRAuthErrrorCodeAccountExistsWithDifferentCredential = 17012,
    
    /*
     Indicates the user has attemped to change email or password more than 5 minutes after
        signing in.
     */
    FIRAuthErrorCodeRequiresRecentLogin = 17014,
    
    /*
     Indicates an attempt to link a provider to which the account is already linked.
     */
    FIRAuthErrorCodeProviderAlreadyLinked = 17015,
    
    /*
     Indicates an attempt to unlink a provider that is not linked.
     */
    FIRAuthErrorCodeNoSuchProvider = 17016,
    
    /*
     Indicates user's saved auth credential is invalid, the user needs to sign in again.
     */
    FIRAuthErrorCodeInvalidUserToken = 17017,
    
    /*
     Indicates a network error occurred (such as a timeout, interrupted connection, or
        unreachable host). These types of errors are often recoverable with a retry. The @c
        NSUnderlyingError field in the @c NSError.userInfo dictionary will contain the error
        encountered.
     */
    FIRAuthErrorCodeNetworkError = 17020,
    
    /*
     Indicates the saved token has expired, for example, the user may have changed account
        password on another device. The user needs to sign in again on the device that made this
        request.
     */
    FIRAuthErrorCodeUserTokenExpired = 17021,
    
    /*
     Indicates an invalid API key was supplied in the request.
     */
    FIRAuthErrorCodeInvalidAPIKey = 17023,
    
    /*
     Indicates that an attempt was made to reauthenticate with a user which is not the current
        user.
     */
    FIRAuthErrorCodeUserMismatch = 17024,
    
    /*
     Indicates an attempt to link with a credential that has already been linked with a
        different Firebase account
     */
    FIRAuthErrorCodeCredentialAlreadyInUse = 17025,
    
    /*
     Indicates an attempt to set a password that is considered too weak.
     */
    FIRAuthErrorCodeWeakPassword = 17026,
    
    /*
     Indicates the App is not authorized to use Firebase Authentication with the
        provided API Key.
     */
    FIRAuthErrorCodeAppNotAuthorized = 17028,
    
    /*
     Indicates the OOB code is expired.
     */
    FIRAuthErrorCodeExpiredActionCode = 17029,
    
    /*
     Indicates the OOB code is invalid.
     */
    FIRAuthErrorCodeInvalidActionCode = 17030,
    
    /*
     Indicates that there are invalid parameters in the payload during a "send password reset
     *  email" attempt.
     */
    FIRAuthErrorCodeInvalidMessagePayload = 17031,
    
    /*
     Indicates that the sender email is invalid during a "send password reset email" attempt.
     */
    FIRAuthErrorCodeInvalidSender = 17032,
    
    /*
     Indicates that the recipient email is invalid.
     */
    FIRAuthErrorCodeInvalidRecipientEmail = 17033,
    
    /*
     Indicates an error occurred while attempting to access the keychain.
     */
    FIRAuthErrorCodeKeychainError = 17995,
    
    /*
     Indicates an internal error occurred.
     */
    FIRAuthErrorCodeInternalError = 17999,
    
  • 3

    IOS Auth错误是:

    名称:哈希; RawValue(代码):

    - AccountExistsWithDifferentCredential: 10; 17012
     - InvalidEmail: 6; 17008
     - NetworkError: 15; 17020
     - UserDisabled: 3; 17005
     - UserMismatch: 18; 17024
     - UserNotFound: 9; 17011
     - WeakPassword: 20; 17026
     - InternalError: 23; 17999
     - InvalidAPIKey: 17; 17023
     - KeychainError: 22; 17995
     - WrongPassword: 7; 17009
     - NoSuchProvider: 13; 17016
     - TooManyRequests: 8; 17010
     - AppNotAuthorized: 21; 17028
     - InvalidUserToken: 14; 17017
     - UserTokenExpired: 16; 17021
     - EmailAlreadyInUse: 5; 17007
     - InvalidCredential: 2; 17004
     - InvalidCustomToken: 0; 17000
     - CustomTokenMismatch: 1; 17002
     - OperationNotAllowed: 4; 17006
     - RequiresRecentLogin: 11; 17014
     - ProviderAlreadyLinked: 12; 17015
     - CredentialAlreadyInUse: 19; 17025
    

相关问题