Skip to content

Instantly share code, notes, and snippets.

@opotapov-sygic
Created September 27, 2017 11:27
Show Gist options
  • Save opotapov-sygic/d4fc248afbad4e2f8c269bace81323b7 to your computer and use it in GitHub Desktop.
Save opotapov-sygic/d4fc248afbad4e2f8c269bace81323b7 to your computer and use it in GitHub Desktop.
Firebase errors descriptions
//source https://stackoverflow.com/questions/39644934/firebase-authentication-error-handling
guard let error = FIRAuthErrorCode(rawValue: (error?._code)!) else {
return
}
fireErrorHandle(code: error)
func fireErrorHandle(code: FIRAuthErrorCode) {
switch code {
case .errorCodeInvalidCustomToken:
print("Indicates a validation error with the custom token")
case .errorCodeCustomTokenMismatch:
print("Indicates the service account and the API key belong to different projects")
case .errorCodeInvalidCredential:
print("Indicates the IDP token or requestUri is invalid")
case .errorCodeUserDisabled:
print("Indicates the user's account is disabled on the server")
case .errorCodeOperationNotAllowed:
print("Indicates the administrator disabled sign in with the specified identity provider")
case .errorCodeEmailAlreadyInUse:
print("Indicates the email used to attempt a sign up is already in use.")
case .errorCodeInvalidEmail:
print("Indicates the email is invalid")
case .errorCodeWrongPassword:
print("Indicates the user attempted sign in with a wrong password")
case .errorCodeTooManyRequests:
print("Indicates that too many requests were made to a server method")
case .errorCodeUserNotFound:
print("Indicates the user account was not found")
case .errorCodeAccountExistsWithDifferentCredential:
print("Indicates account linking is required")
case .errorCodeRequiresRecentLogin:
print("Indicates the user has attemped to change email or password more than 5 minutes after signing in")
case .errorCodeProviderAlreadyLinked:
print("Indicates an attempt to link a provider to which the account is already linked")
case .errorCodeNoSuchProvider:
print("Indicates an attempt to unlink a provider that is not linked")
case .errorCodeInvalidUserToken:
print("Indicates user's saved auth credential is invalid, the user needs to sign in again")
case .errorCodeNetworkError:
print("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 @cNSUnderlyingError field in the @c NSError.userInfo dictionary will contain the error encountered")
case .errorCodeUserTokenExpired:
print("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")
case .errorCodeInvalidAPIKey:
print("Indicates an invalid API key was supplied in the request")
case .errorCodeUserMismatch:
print("Indicates that an attempt was made to reauthenticate with a user which is not the current user")
case .errorCodeCredentialAlreadyInUse:
print("Indicates an attempt to link with a credential that has already been linked with a different Firebase account")
case .errorCodeWeakPassword:
print("Indicates an attempt to set a password that is considered too weak")
case .errorCodeAppNotAuthorized:
print("Indicates the App is not authorized to use Firebase Authentication with the provided API Key")
case .errorCodeKeychainError:
print("Indicates an error occurred while attempting to access the keychain")
default:
print("Indicates an internal error occurred")
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment