Files
firebase-ios-sdk/FirebaseAuth/Sources/Utilities/FIRAuthErrorUtils.m
T

1398 lines
60 KiB
Objective-C
Raw Normal View History

2017-05-15 12:27:07 -07:00
/*
* Copyright 2017 Google
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
2020-04-10 11:54:51 -07:00
#import "FirebaseAuth/Sources/Utilities/FIRAuthErrorUtils.h"
2017-05-15 12:27:07 -07:00
2020-07-27 15:21:19 -07:00
#import "FirebaseAuth/Sources/Public/FirebaseAuth/FIRAuthCredential.h"
2020-04-10 11:54:51 -07:00
#import "FirebaseAuth/Sources/MultiFactor/FIRMultiFactorResolver+Internal.h"
2017-05-15 12:27:07 -07:00
NS_ASSUME_NONNULL_BEGIN
NSString *const FIRAuthErrorDomain = @"FIRAuthErrorDomain";
NSString *const FIRAuthInternalErrorDomain = @"FIRAuthInternalErrorDomain";
NSString *const FIRAuthErrorUserInfoDeserializedResponseKey =
@"FIRAuthErrorUserInfoDeserializedResponseKey";
NSString *const FIRAuthErrorUserInfoDataKey = @"FIRAuthErrorUserInfoDataKey";
NSString *const FIRAuthErrorUserInfoEmailKey = @"FIRAuthErrorUserInfoEmailKey";
2019-02-22 21:23:17 -08:00
NSString *const FIRAuthErrorUserInfoUpdatedCredentialKey =
@"FIRAuthErrorUserInfoUpdatedCredentialKey";
NSString *const FIRAuthErrorUserInfoNameKey = @"FIRAuthErrorUserInfoNameKey";
2020-03-17 10:22:29 -07:00
NSString *const FIRAuthErrorUserInfoMultiFactorResolverKey =
@"FIRAuthErrorUserInfoMultiFactorResolverKey";
2020-03-10 13:30:20 -07:00
2017-05-15 12:27:07 -07:00
/** @var kServerErrorDetailMarker
@brief This marker indicates that the server error message contains a detail error message which
should be used instead of the hardcoded client error message.
*/
static NSString *const kServerErrorDetailMarker = @" : ";
#pragma mark - URL response error codes
/** @var kURLResponseErrorCodeInvalidClientID
@brief Error code that indicates that the client ID provided was invalid.
*/
static NSString *const kURLResponseErrorCodeInvalidClientID = @"auth/invalid-oauth-client-id";
/** @var kURLResponseErrorCodeNetworkRequestFailed
@brief Error code that indicates that a network request within the SFSafariViewController or
WKWebView failed.
*/
static NSString *const kURLResponseErrorCodeNetworkRequestFailed = @"auth/network-request-failed";
/** @var kURLResponseErrorCodeInternalError
2018-09-17 13:00:50 -04:00
@brief Error code that indicates that an internal error occurred within the
SFSafariViewController or WKWebView failed.
*/
static NSString *const kURLResponseErrorCodeInternalError = @"auth/internal-error";
2017-05-15 12:27:07 -07:00
#pragma mark - Standard Error Messages
/** @var kFIRAuthErrorMessageInvalidCustomToken
@brief Message for @c FIRAuthErrorCodeInvalidCustomToken error code.
*/
2020-03-17 10:22:29 -07:00
static NSString *const kFIRAuthErrorMessageInvalidCustomToken =
@"The custom token format is "
"incorrect. Please check the documentation.";
2017-05-15 12:27:07 -07:00
/** @var kFIRAuthErrorMessageCustomTokenMismatch
@brief Message for @c FIRAuthErrorCodeCustomTokenMismatch error code.
*/
static NSString *const kFIRAuthErrorMessageCustomTokenMismatch = @"The custom token corresponds to "
2020-03-17 10:22:29 -07:00
"a different audience.";
2017-05-15 12:27:07 -07:00
/** @var kFIRAuthErrorMessageInvalidEmail
@brief Message for @c FIRAuthErrorCodeInvalidEmail error code.
*/
static NSString *const kFIRAuthErrorMessageInvalidEmail = @"The email address is badly formatted.";
/** @var kFIRAuthErrorMessageInvalidCredential
@brief Message for @c FIRAuthErrorCodeInvalidCredential error code.
*/
static NSString *const kFIRAuthErrorMessageInvalidCredential = @"The supplied auth credential is "
2020-03-17 10:22:29 -07:00
"malformed or has expired.";
2017-05-15 12:27:07 -07:00
/** @var kFIRAuthErrorMessageUserDisabled
@brief Message for @c FIRAuthErrorCodeUserDisabled error code.
*/
static NSString *const kFIRAuthErrorMessageUserDisabled = @"The user account has been disabled by "
2020-03-17 10:22:29 -07:00
"an administrator.";
2017-05-15 12:27:07 -07:00
/** @var kFIRAuthErrorMessageEmailAlreadyInUse
@brief Message for @c FIRAuthErrorCodeEmailAlreadyInUse error code.
*/
static NSString *const kFIRAuthErrorMessageEmailAlreadyInUse = @"The email address is already in "
2020-03-17 10:22:29 -07:00
"use by another account.";
2017-05-15 12:27:07 -07:00
/** @var kFIRAuthErrorMessageWrongPassword
@brief Message for @c FIRAuthErrorCodeWrongPassword error code.
*/
static NSString *const kFIRAuthErrorMessageWrongPassword = @"The password is invalid or the user "
2020-03-17 10:22:29 -07:00
"does not have a password.";
2017-05-15 12:27:07 -07:00
/** @var kFIRAuthErrorMessageTooManyRequests
@brief Message for @c FIRAuthErrorCodeTooManyRequests error code.
*/
2020-03-17 10:22:29 -07:00
static NSString *const kFIRAuthErrorMessageTooManyRequests =
@"We have blocked all requests from "
"this device due to unusual activity. Try again later.";
2017-05-15 12:27:07 -07:00
/** @var kFIRAuthErrorMessageAccountExistsWithDifferentCredential
2017-12-01 15:32:25 -08:00
@brief Message for @c FIRAuthErrorCodeAccountExistsWithDifferentCredential error code.
2017-05-15 12:27:07 -07:00
*/
2020-03-17 10:22:29 -07:00
static NSString *const kFIRAuthErrorMessageAccountExistsWithDifferentCredential =
@"An account "
"already exists with the same email address but different sign-in credentials. Sign in using "
"a "
"provider associated with this email address.";
2017-05-15 12:27:07 -07:00
/** @var kFIRAuthErrorMessageRequiresRecentLogin
@brief Message for @c FIRAuthErrorCodeRequiresRecentLogin error code.
*/
2020-03-17 10:22:29 -07:00
static NSString *const kFIRAuthErrorMessageRequiresRecentLogin =
@"This operation is sensitive and "
"requires recent authentication. Log in again before retrying this request.";
2017-05-15 12:27:07 -07:00
/** @var kFIRAuthErrorMessageProviderAlreadyLinked
@brief Message for @c FIRAuthErrorCodeProviderAlreadyExists error code.
*/
static NSString *const kFIRAuthErrorMessageProviderAlreadyLinked =
@"[ERROR_PROVIDER_ALREADY_LINKED] - User can only be linked to one identity for the given "
2020-03-17 10:22:29 -07:00
"provider.";
2017-05-15 12:27:07 -07:00
/** @var kFIRAuthErrorMessageNoSuchProvider
@brief Message for @c FIRAuthErrorCodeNoSuchProvider error code.
*/
static NSString *const kFIRAuthErrorMessageNoSuchProvider = @"User was not linked to an account "
2020-03-17 10:22:29 -07:00
"with the given provider.";
2017-05-15 12:27:07 -07:00
/** @var kFIRAuthErrorMessageInvalidUserToken
@brief Message for @c FIRAuthErrorCodeInvalidUserToken error code.
*/
2020-03-17 10:22:29 -07:00
static NSString *const kFIRAuthErrorMessageInvalidUserToken =
@"This user's credential isn't valid "
"for this project. This can happen if the user's token has been tampered with, or if the user "
"doesn’t belong to the project associated with the API key used in your request.";
2017-05-15 12:27:07 -07:00
/** @var kFIRAuthErrorMessageNetworkError
@brief Message for @c FIRAuthErrorCodeNetworkError error code.
*/
2020-03-17 10:22:29 -07:00
static NSString *const kFIRAuthErrorMessageNetworkError =
@"Network error (such as timeout, "
"interrupted connection or unreachable host) has occurred.";
2017-05-15 12:27:07 -07:00
/** @var kFIRAuthErrorMessageKeychainError
@brief Message for @c FIRAuthErrorCodeKeychainError error code.
*/
2020-03-17 10:22:29 -07:00
static NSString *const kFIRAuthErrorMessageKeychainError =
@"An error occurred when accessing the "
"keychain. The @c NSLocalizedFailureReasonErrorKey field in the @c NSError.userInfo "
"dictionary "
"will contain more information about the error encountered";
2017-05-15 12:27:07 -07:00
/** @var kFIRAuthErrorMessageMissingClientIdentifier
@brief Message for @c FIRAuthErrorCodeMissingClientIdentifier error code.
*/
2020-03-17 10:22:29 -07:00
static NSString *const kFIRAuthErrorMessageMissingClientIdentifier =
@"The request does not contain "
"any client identifier.";
2017-05-15 12:27:07 -07:00
/** @var kFIRAuthErrorMessageUserTokenExpired
@brief Message for @c FIRAuthErrorCodeTokenExpired error code.
*/
2020-03-17 10:22:29 -07:00
static NSString *const kFIRAuthErrorMessageUserTokenExpired =
@"The user's credential is no longer "
"valid. The user must sign in again.";
2017-05-15 12:27:07 -07:00
/** @var kFIRAuthErrorMessageUserNotFound
@brief Message for @c FIRAuthErrorCodeUserNotFound error code.
*/
2020-03-17 10:22:29 -07:00
static NSString *const kFIRAuthErrorMessageUserNotFound =
@"There is no user record corresponding "
"to this identifier. The user may have been deleted.";
2017-05-15 12:27:07 -07:00
/** @var kFIRAuthErrorMessageInvalidAPIKey
@brief Message for @c FIRAuthErrorCodeInvalidAPIKey error code.
@remarks This error is not thrown by the server.
*/
static NSString *const kFIRAuthErrorMessageInvalidAPIKey = @"An invalid API Key was supplied in "
2020-03-17 10:22:29 -07:00
"the request.";
2017-05-15 12:27:07 -07:00
/** @var kFIRAuthErrorMessageUserMismatch.
@brief Message for @c FIRAuthErrorCodeInvalidAPIKey error code.
*/
2020-03-17 10:22:29 -07:00
static NSString *const FIRAuthErrorMessageUserMismatch =
@"The supplied credentials do not "
"correspond to the previously signed in user.";
2017-05-15 12:27:07 -07:00
/** @var kFIRAuthErrorMessageCredentialAlreadyInUse
@brief Message for @c FIRAuthErrorCodeCredentialAlreadyInUse error code.
*/
2020-03-17 10:22:29 -07:00
static NSString *const kFIRAuthErrorMessageCredentialAlreadyInUse =
@"This credential is already "
"associated with a different user account.";
2017-05-15 12:27:07 -07:00
/** @var kFIRAuthErrorMessageOperationNotAllowed
@brief Message for @c FIRAuthErrorCodeOperationNotAllowed error code.
*/
2020-03-17 10:22:29 -07:00
static NSString *const kFIRAuthErrorMessageOperationNotAllowed =
@"The given sign-in provider is "
"disabled for this Firebase project. Enable it in the Firebase console, under the sign-in "
"method tab of the Auth section.";
2017-05-15 12:27:07 -07:00
/** @var kFIRAuthErrorMessageWeakPassword
@brief Message for @c FIRAuthErrorCodeWeakPassword error code.
*/
static NSString *const kFIRAuthErrorMessageWeakPassword = @"The password must be 6 characters long "
2020-03-17 10:22:29 -07:00
"or more.";
2017-05-15 12:27:07 -07:00
/** @var kFIRAuthErrorMessageAppNotAuthorized
@brief Message for @c FIRAuthErrorCodeAppNotAuthorized error code.
*/
2020-03-17 10:22:29 -07:00
static NSString *const kFIRAuthErrorMessageAppNotAuthorized =
@"This app is not authorized to use "
"Firebase Authentication with the provided API key. Review your key configuration in the "
"Google API console and ensure that it accepts requests from your app's bundle ID.";
2017-05-15 12:27:07 -07:00
/** @var kFIRAuthErrorMessageExpiredActionCode
@brief Message for @c FIRAuthErrorCodeExpiredActionCode error code.
*/
static NSString *const kFIRAuthErrorMessageExpiredActionCode = @"The action code has expired.";
/** @var kFIRAuthErrorMessageInvalidActionCode
@brief Message for @c FIRAuthErrorCodeInvalidActionCode error code.
*/
2020-03-17 10:22:29 -07:00
static NSString *const kFIRAuthErrorMessageInvalidActionCode =
@"The action code is invalid. This "
"can happen if the code is malformed, expired, or has already been used.";
2017-05-15 12:27:07 -07:00
/** @var kFIRAuthErrorMessageInvalidMessagePayload
@brief Message for @c FIRAuthErrorCodeInvalidMessagePayload error code.
*/
2020-03-17 10:22:29 -07:00
static NSString *const kFIRAuthErrorMessageInvalidMessagePayload =
@"The action code is invalid. "
"This can happen if the code is malformed, expired, or has already been used.";
2017-05-15 12:27:07 -07:00
/** @var kFIRAuthErrorMessageInvalidSender
@brief Message for @c FIRAuthErrorCodeInvalidSender error code.
*/
2020-03-17 10:22:29 -07:00
static NSString *const kFIRAuthErrorMessageInvalidSender =
@"The email template corresponding to "
"this action contains invalid characters in its message. Please fix by going to the Auth "
"email "
"templates section in the Firebase Console.";
2017-05-15 12:27:07 -07:00
/** @var kFIRAuthErrorMessageInvalidRecipientEmail
@brief Message for @c FIRAuthErrorCodeInvalidRecipient error code.
*/
2020-03-17 10:22:29 -07:00
static NSString *const kFIRAuthErrorMessageInvalidRecipientEmail =
@"The action code is invalid. "
"This can happen if the code is malformed, expired, or has already been used.";
2017-05-15 12:27:07 -07:00
2017-07-28 17:43:33 -07:00
/** @var kFIRAuthErrorMessageMissingIosBundleID
@brief Message for @c FIRAuthErrorCodeMissingIosbundleID error code.
*/
static NSString *const kFIRAuthErrorMessageMissingIosBundleID =
@"An iOS Bundle ID must be provided if an App Store ID is provided.";
/** @var kFIRAuthErrorMessageMissingAndroidPackageName
@brief Message for @c FIRAuthErrorCodeMissingAndroidPackageName error code.
*/
static NSString *const kFIRAuthErrorMessageMissingAndroidPackageName =
@"An Android Package Name must be provided if the Android App is required to be installed.";
/** @var kFIRAuthErrorMessageUnauthorizedDomain
@brief Message for @c FIRAuthErrorCodeUnauthorizedDomain error code.
*/
2020-03-17 10:22:29 -07:00
static NSString *const kFIRAuthErrorMessageUnauthorizedDomain =
@"The domain of the continue URL "
"is not whitelisted. Please whitelist the domain in the Firebase console.";
2017-07-28 17:43:33 -07:00
/** @var kFIRAuthErrorMessageInvalidContinueURI
@brief Message for @c FIRAuthErrorCodeInvalidContinueURI error code.
*/
static NSString *const kFIRAuthErrorMessageInvalidContinueURI =
@"The continue URL provided in the request is invalid.";
2017-06-01 18:12:09 -07:00
/** @var kFIRAuthErrorMessageMissingEmail
@brief Message for @c FIRAuthErrorCodeMissingEmail error code.
*/
static NSString *const kFIRAuthErrorMessageMissingEmail = @"An email address must be provided.";
2017-05-15 12:27:07 -07:00
/** @var kFIRAuthErrorMessageMissingContinueURI
@brief Message for @c FIRAuthErrorCodeMissingContinueURI error code.
*/
static NSString *const kFIRAuthErrorMessageMissingContinueURI =
@"A continue URL must be provided in the request.";
/** @var kFIRAuthErrorMessageMissingPhoneNumber
@brief Message for @c FIRAuthErrorCodeMissingPhoneNumber error code.
*/
static NSString *const kFIRAuthErrorMessageMissingPhoneNumber =
@"To send verification codes, provide a phone number for the recipient.";
/** @var kFIRAuthErrorMessageInvalidPhoneNumber
@brief Message for @c FIRAuthErrorCodeInvalidPhoneNumber error code.
2017-05-15 12:27:07 -07:00
*/
static NSString *const kFIRAuthErrorMessageInvalidPhoneNumber =
@"The format of the phone number provided is incorrect. Please enter the phone number in a "
2020-03-17 10:22:29 -07:00
"format that can be parsed into E.164 format. E.164 phone numbers are written in the format "
"[+][country code][subscriber number including area code].";
2017-05-15 12:27:07 -07:00
/** @var kFIRAuthErrorMessageMissingVerificationCode
@brief Message for @c FIRAuthErrorCodeMissingVerificationCode error code.
*/
static NSString *const kFIRAuthErrorMessageMissingVerificationCode =
@"The phone auth credential was created with an empty SMS verification Code.";
2017-05-15 12:27:07 -07:00
/** @var kFIRAuthErrorMessageInvalidVerificationCode
@brief Message for @c FIRAuthErrorCodeInvalidVerificationCode error code.
*/
static NSString *const kFIRAuthErrorMessageInvalidVerificationCode =
@"The SMS verification code used to create the phone auth credential is invalid. Please resend "
2020-03-17 10:22:29 -07:00
"the verification code SMS and be sure to use the verification code provided by the user.";
2017-05-15 12:27:07 -07:00
/** @var kFIRAuthErrorMessageMissingVerificationID
@brief Message for @c FIRAuthErrorCodeInvalidVerificationID error code.
*/
static NSString *const kFIRAuthErrorMessageMissingVerificationID =
@"The phone auth credential was created with an empty verification ID.";
2017-05-15 12:27:07 -07:00
/** @var kFIRAuthErrorMessageInvalidVerificationID
@brief Message for @c FIRAuthErrorCodeInvalidVerificationID error code.
*/
static NSString *const kFIRAuthErrorMessageInvalidVerificationID =
@"The verification ID used to create the phone auth credential is invalid.";
2018-11-30 17:30:22 -08:00
/** @var kFIRAuthErrorMessageLocalPlayerNotAuthenticated
2019-02-06 11:15:08 -08:00
@brief Message for @c FIRAuthErrorCodeLocalPlayerNotAuthenticated error code.
2018-11-30 17:30:22 -08:00
*/
static NSString *const kFIRAuthErrorMessageLocalPlayerNotAuthenticated =
@"The local player is not authenticated. Please log the local player in to Game Center.";
2019-02-06 11:15:08 -08:00
/** @var kFIRAuthErrorMessageGameKitNotLinked
@brief Message for @c kFIRAuthErrorMessageGameKitNotLinked error code.
*/
static NSString *const kFIRAuthErrorMessageGameKitNotLinked =
@"The GameKit framework is not linked. Please turn on the Game Center capability.";
2017-05-15 12:27:07 -07:00
/** @var kFIRAuthErrorMessageSessionExpired
@brief Message for @c FIRAuthErrorCodeSessionExpired error code.
*/
2020-03-17 10:22:29 -07:00
static NSString *const kFIRAuthErrorMessageSessionExpired =
@"The SMS code has expired. Please "
2017-05-15 12:27:07 -07:00
@"re-send the verification code to try again.";
/** @var kFIRAuthErrorMessageMissingAppCredential
@brief Message for @c FIRAuthErrorCodeMissingAppCredential error code.
*/
2020-03-17 10:22:29 -07:00
static NSString *const kFIRAuthErrorMessageMissingAppCredential =
@"The phone verification request "
"is missing an APNs Device token. Firebase Auth automatically detects APNs Device Tokens, "
"however, if method swizzling is disabled, the APNs token must be set via the APNSToken "
"property on FIRAuth or by calling setAPNSToken:type on FIRAuth.";
2017-05-15 12:27:07 -07:00
/** @var kFIRAuthErrorMessageInvalidAppCredential
@brief Message for @c FIRAuthErrorCodeInvalidAppCredential error code.
*/
2020-03-17 10:22:29 -07:00
static NSString *const kFIRAuthErrorMessageInvalidAppCredential =
@"The APNs device token provided "
"is either incorrect or does not match the private certificate uploaded to the Firebase "
"Console.";
2017-05-15 12:27:07 -07:00
/** @var kFIRAuthErrorMessageQuotaExceeded
@brief Message for @c FIRAuthErrorCodeQuotaExceeded error code.
*/
2020-06-02 15:03:39 -07:00
static NSString *const kFIRAuthErrorMessageQuotaExceeded = @"The quota for this operation "
"has been exceeded.";
2017-05-15 12:27:07 -07:00
/** @var kFIRAuthErrorMessageMissingAppToken
@brief Message for @c FIRAuthErrorCodeMissingAppToken error code.
*/
2020-03-17 10:22:29 -07:00
static NSString *const kFIRAuthErrorMessageMissingAppToken =
@"There seems to be a problem with "
"your project's Firebase phone number authentication set-up, please make sure to follow the "
"instructions found at https://firebase.google.com/docs/auth/ios/phone-auth";
2017-05-15 12:27:07 -07:00
/** @var kFIRAuthErrorMessageMissingAppToken
@brief Message for @c FIRAuthErrorCodeMissingAppToken error code.
*/
2020-03-17 10:22:29 -07:00
static NSString *const kFIRAuthErrorMessageNotificationNotForwarded =
@"If app delegate swizzling "
"is disabled, remote notifications received by UIApplicationDelegate need to be forwarded to "
"FIRAuth's canHandleNotificaton: method.";
2017-05-15 12:27:07 -07:00
/** @var kFIRAuthErrorMessageAppNotVerified
@brief Message for @c FIRAuthErrorCodeMissingAppToken error code.
*/
2020-03-17 10:22:29 -07:00
static NSString *const kFIRAuthErrorMessageAppNotVerified =
@"Firebase could not retrieve the "
"silent push notification and therefore could not verify your app. Ensure that you configured "
"your app correctly to receive push notifications.";
2017-05-15 12:27:07 -07:00
2017-08-23 09:02:50 -07:00
/** @var kFIRAuthErrorMessageCaptchaCheckFailed
@brief Message for @c FIRAuthErrorCodeCaptchaCheckFailed error code.
*/
2020-03-17 10:22:29 -07:00
static NSString *const kFIRAuthErrorMessageCaptchaCheckFailed =
@"The reCAPTCHA response token "
"provided is either invalid, expired or already";
2017-08-23 09:02:50 -07:00
2017-09-01 13:38:12 -07:00
/** @var kFIRAuthErrorMessageWebContextAlreadyPresented
@brief Message for @c FIRAuthErrorCodeWebContextAlreadyPresented error code.
*/
2020-03-17 10:22:29 -07:00
static NSString *const kFIRAuthErrorMessageWebContextAlreadyPresented =
@"User interaction is "
"still ongoing, another view cannot be presented.";
2017-09-01 13:38:12 -07:00
/** @var kFIRAuthErrorMessageWebContextCancelled
@brief Message for @c FIRAuthErrorCodeWebContextCancelled error code.
*/
static NSString *const kFIRAuthErrorMessageWebContextCancelled = @"The interaction was cancelled "
2020-03-17 10:22:29 -07:00
"by the user.";
2017-09-01 13:38:12 -07:00
/** @var kFIRAuthErrorMessageInvalidClientID
@brief Message for @c FIRAuthErrorCodeInvalidClientID error code.
*/
2020-03-17 10:22:29 -07:00
static NSString *const kFIRAuthErrorMessageInvalidClientID =
@"The OAuth client ID provided is "
"either invalid or does not match the specified API key.";
/** @var kFIRAuthErrorMessageWebRequestFailed
@brief Message for @c FIRAuthErrorCodeWebRequestFailed error code.
*/
2020-03-17 10:22:29 -07:00
static NSString *const kFIRAuthErrorMessageWebRequestFailed =
@"A network error (such as timeout, "
"interrupted connection, or unreachable host) has occurred within the web context.";
/** @var kFIRAuthErrorMessageWebInternalError
@brief Message for @c FIRAuthErrorCodeWebInternalError error code.
*/
2020-03-17 10:22:29 -07:00
static NSString *const kFIRAuthErrorMessageWebInternalError =
@"An internal error has occurred "
"within the SFSafariViewController or WKWebView.";
/** @var kFIRAuthErrorMessageAppVerificationUserInteractionFailure
@brief Message for @c FIRAuthErrorCodeInvalidClientID error code.
*/
2020-03-17 10:22:29 -07:00
static NSString *const kFIRAuthErrorMessageAppVerificationUserInteractionFailure =
@"The app "
"verification process has failed, print and inspect the error details for more information";
2018-04-03 17:19:51 -07:00
/** @var kFIRAuthErrorMessageNullUser
@brief Message for @c FIRAuthErrorCodeNullUser error code.
*/
2020-03-17 10:22:29 -07:00
static NSString *const kFIRAuthErrorMessageNullUser =
@"A null user object was provided as the "
"argument for an operation which requires a non-null user object.";
2018-04-03 17:19:51 -07:00
/** @var kFIRAuthErrorMessageInvalidProviderID
@brief Message for @c FIRAuthErrorCodeInvalidProviderID error code.
*/
2020-03-17 10:22:29 -07:00
static NSString *const kFIRAuthErrorMessageInvalidProviderID =
@"The provider ID provided for the "
"attempted web operation is invalid.";
2018-11-26 22:19:29 -08:00
/** @var kFIRAuthErrorMessageInvalidDynamicLinkDomain
@brief Message for @c kFIRAuthErrorMessageInvalidDynamicLinkDomain error code.
*/
2020-03-17 10:22:29 -07:00
static NSString *const kFIRAuthErrorMessageInvalidDynamicLinkDomain =
@"The "
"Firebase Dynamic Link domain used is either not configured or is unauthorized "
"for the current project.";
2018-11-26 22:19:29 -08:00
2017-05-15 12:27:07 -07:00
/** @var kFIRAuthErrorMessageInternalError
@brief Message for @c FIRAuthErrorCodeInternalError error code.
*/
2020-03-17 10:22:29 -07:00
static NSString *const kFIRAuthErrorMessageInternalError =
@"An internal error has occurred, "
"print and inspect the error details for more information.";
2017-05-15 12:27:07 -07:00
2018-06-21 12:10:05 -07:00
/** @var kFIRAuthErrorMessageMalformedJWT
@brief Error message constant describing @c FIRAuthErrorCodeMalformedJWT errors.
*/
static NSString *const kFIRAuthErrorMessageMalformedJWT =
@"Failed to parse JWT. Check the userInfo dictionary for the full token.";
2020-03-10 13:30:20 -07:00
/** @var kFIRAuthErrorMessageSecondFactorRequired
@brief Message for @c kFIRAuthErrorMessageSecondFactorRequired error code.
*/
static NSString *const kFIRAuthErrorMessageSecondFactorRequired =
@"Please complete a second factor challenge to finish signing into this account.";
/** @var kFIRAuthErrorMessageSecondFactorRequired
@brief Message for @c kFIRAuthErrorMessageSecondFactorRequired error code.
*/
static NSString *const FIRAuthErrorMessageMissingMultiFactorSession =
2020-03-17 10:22:29 -07:00
@"The request is missing proof of first factor successful sign-in.";
2020-03-10 13:30:20 -07:00
/** @var kFIRAuthErrorMessageSecondFactorRequired
@brief Message for @c kFIRAuthErrorMessageSecondFactorRequired error code.
*/
static NSString *const FIRAuthErrorMessageMissingMultiFactorInfo =
2020-03-17 10:22:29 -07:00
@"No second factor identifier is provided.";
2020-03-10 13:30:20 -07:00
/** @var kFIRAuthErrorMessageSecondFactorRequired
@brief Message for @c kFIRAuthErrorMessageSecondFactorRequired error code.
*/
static NSString *const FIRAuthErrorMessageInvalidMultiFactorSession =
2020-03-17 10:22:29 -07:00
@"The request does not contain a valid proof of first factor successful sign-in.";
2020-03-10 13:30:20 -07:00
/** @var kFIRAuthErrorMessageSecondFactorRequired
@brief Message for @c kFIRAuthErrorMessageSecondFactorRequired error code.
*/
static NSString *const FIRAuthErrorMessageMultiFactorInfoNotFound =
2020-03-17 10:22:29 -07:00
@"The user does not have a second factor matching the identifier provided.";
2020-03-10 13:30:20 -07:00
/** @var kFIRAuthErrorMessageSecondFactorRequired
@brief Message for @c kFIRAuthErrorMessageSecondFactorRequired error code.
*/
static NSString *const FIRAuthErrorMessageAdminRestrictedOperation =
2020-03-17 10:22:29 -07:00
@"This operation is restricted to administrators only.";
2020-03-10 13:30:20 -07:00
/** @var kFIRAuthErrorMessageSecondFactorRequired
@brief Message for @c kFIRAuthErrorMessageSecondFactorRequired error code.
*/
static NSString *const FIRAuthErrorMessageUnverifiedEmail =
2020-03-17 10:22:29 -07:00
@"The operation requires a verified email.";
2020-03-10 13:30:20 -07:00
/** @var kFIRAuthErrorMessageSecondFactorRequired
@brief Message for @c kFIRAuthErrorMessageSecondFactorRequired error code.
*/
static NSString *const FIRAuthErrorMessageSecondFactorAlreadyEnrolled =
2020-03-17 10:22:29 -07:00
@"The second factor is already enrolled on this account.";
2020-03-10 13:30:20 -07:00
/** @var kFIRAuthErrorMessageSecondFactorRequired
@brief Message for @c kFIRAuthErrorMessageSecondFactorRequired error code.
*/
static NSString *const FIRAuthErrorMessageMaximumSecondFactorCountExceeded =
2020-03-17 10:22:29 -07:00
@"The maximum allowed number of second factors on a user has been exceeded.";
2020-03-10 13:30:20 -07:00
/** @var kFIRAuthErrorMessageSecondFactorRequired
@brief Message for @c kFIRAuthErrorMessageSecondFactorRequired error code.
*/
static NSString *const FIRAuthErrorMessageUnsupportedFirstFactor =
2020-03-17 10:22:29 -07:00
@"Enrolling a second factor or signing in with a multi-factor account requires sign-in with a "
@"supported first factor.";
2020-03-10 13:30:20 -07:00
/** @var kFIRAuthErrorMessageSecondFactorRequired
@brief Message for @c kFIRAuthErrorMessageSecondFactorRequired error code.
*/
static NSString *const FIRAuthErrorMessageEmailChangeNeedsVerification =
2020-03-17 10:22:29 -07:00
@"Multi-factor users must always have a verified email.";
2020-03-10 13:30:20 -07:00
/** @var kFIRAuthErrorMessageDynamicLinkNotActivated
@brief Error message constant describing @c FIRAuthErrorCodeDynamicLinkNotActivated errors.
*/
static NSString *const kFIRAuthErrorMessageDynamicLinkNotActivated =
@"Please activate Dynamic Links in the Firebase Console and agree to the terms and conditions.";
/** @var kFIRAuthErrorMessageRejectedCredential
@brief Error message constant describing @c FIRAuthErrorCodeRejectedCredential errors.
*/
static NSString *const kFIRAuthErrorMessageRejectedCredential =
@"The request contains malformed or mismatching credentials.";
/** @var kFIRAuthErrorMessageMissingOrInvalidNonce
@brief Error message constant describing @c FIRAuthErrorCodeMissingOrInvalidNonce errors.
*/
static NSString *const kFIRAuthErrorMessageMissingOrInvalidNonce =
@"The request contains malformed or mismatched credentials.";
2020-08-17 17:25:27 -07:00
/** @var kFIRAuthErrorMessageTenantIDMismatch.
@brief Message for @c FIRAuthErrorCodeTenantIDMismatch error code.
*/
static NSString *const kFIRAuthErrorMessageTenantIDMismatch =
@"The provided user's tenant ID does"
"not match the Auth instance's tenant ID.";
/** @var kFIRAuthErrorMessageUnsupportedTenantOperation
@brief Message for @c FIRAuthErrorCodeUnsupportedTenantOperation error code.
*/
static NSString *const kFIRAuthErrorMessageUnsupportedTenantOperation =
@"This operation is not"
"supported in a multi-tenant context.";
2017-05-15 12:27:07 -07:00
/** @var FIRAuthErrorDescription
@brief The error descrioption, based on the error code.
@remarks No default case so that we get a compiler warning if a new value was added to the enum.
*/
static NSString *FIRAuthErrorDescription(FIRAuthErrorCode code) {
switch (code) {
case FIRAuthErrorCodeInvalidCustomToken:
return kFIRAuthErrorMessageInvalidCustomToken;
case FIRAuthErrorCodeCustomTokenMismatch:
return kFIRAuthErrorMessageCustomTokenMismatch;
case FIRAuthErrorCodeInvalidEmail:
return kFIRAuthErrorMessageInvalidEmail;
case FIRAuthErrorCodeInvalidCredential:
return kFIRAuthErrorMessageInvalidCredential;
case FIRAuthErrorCodeUserDisabled:
return kFIRAuthErrorMessageUserDisabled;
case FIRAuthErrorCodeEmailAlreadyInUse:
return kFIRAuthErrorMessageEmailAlreadyInUse;
case FIRAuthErrorCodeWrongPassword:
return kFIRAuthErrorMessageWrongPassword;
case FIRAuthErrorCodeTooManyRequests:
return kFIRAuthErrorMessageTooManyRequests;
case FIRAuthErrorCodeAccountExistsWithDifferentCredential:
return kFIRAuthErrorMessageAccountExistsWithDifferentCredential;
case FIRAuthErrorCodeRequiresRecentLogin:
return kFIRAuthErrorMessageRequiresRecentLogin;
case FIRAuthErrorCodeProviderAlreadyLinked:
return kFIRAuthErrorMessageProviderAlreadyLinked;
case FIRAuthErrorCodeNoSuchProvider:
return kFIRAuthErrorMessageNoSuchProvider;
case FIRAuthErrorCodeInvalidUserToken:
return kFIRAuthErrorMessageInvalidUserToken;
case FIRAuthErrorCodeNetworkError:
return kFIRAuthErrorMessageNetworkError;
case FIRAuthErrorCodeKeychainError:
return kFIRAuthErrorMessageKeychainError;
case FIRAuthErrorCodeMissingClientIdentifier:
return kFIRAuthErrorMessageMissingClientIdentifier;
2017-05-15 12:27:07 -07:00
case FIRAuthErrorCodeUserTokenExpired:
return kFIRAuthErrorMessageUserTokenExpired;
case FIRAuthErrorCodeUserNotFound:
return kFIRAuthErrorMessageUserNotFound;
case FIRAuthErrorCodeInvalidAPIKey:
return kFIRAuthErrorMessageInvalidAPIKey;
case FIRAuthErrorCodeCredentialAlreadyInUse:
return kFIRAuthErrorMessageCredentialAlreadyInUse;
case FIRAuthErrorCodeInternalError:
return kFIRAuthErrorMessageInternalError;
case FIRAuthErrorCodeUserMismatch:
return FIRAuthErrorMessageUserMismatch;
case FIRAuthErrorCodeOperationNotAllowed:
return kFIRAuthErrorMessageOperationNotAllowed;
case FIRAuthErrorCodeWeakPassword:
return kFIRAuthErrorMessageWeakPassword;
case FIRAuthErrorCodeAppNotAuthorized:
return kFIRAuthErrorMessageAppNotAuthorized;
case FIRAuthErrorCodeExpiredActionCode:
return kFIRAuthErrorMessageExpiredActionCode;
case FIRAuthErrorCodeInvalidActionCode:
return kFIRAuthErrorMessageInvalidActionCode;
case FIRAuthErrorCodeInvalidSender:
return kFIRAuthErrorMessageInvalidSender;
case FIRAuthErrorCodeInvalidMessagePayload:
return kFIRAuthErrorMessageInvalidMessagePayload;
case FIRAuthErrorCodeInvalidRecipientEmail:
return kFIRAuthErrorMessageInvalidRecipientEmail;
2017-07-28 17:43:33 -07:00
case FIRAuthErrorCodeMissingIosBundleID:
return kFIRAuthErrorMessageMissingIosBundleID;
case FIRAuthErrorCodeMissingAndroidPackageName:
return kFIRAuthErrorMessageMissingAndroidPackageName;
case FIRAuthErrorCodeUnauthorizedDomain:
return kFIRAuthErrorMessageUnauthorizedDomain;
case FIRAuthErrorCodeInvalidContinueURI:
return kFIRAuthErrorMessageInvalidContinueURI;
case FIRAuthErrorCodeMissingContinueURI:
return kFIRAuthErrorMessageMissingContinueURI;
2017-06-01 18:12:09 -07:00
case FIRAuthErrorCodeMissingEmail:
return kFIRAuthErrorMessageMissingEmail;
2017-05-15 12:27:07 -07:00
case FIRAuthErrorCodeMissingPhoneNumber:
return kFIRAuthErrorMessageMissingPhoneNumber;
case FIRAuthErrorCodeInvalidPhoneNumber:
return kFIRAuthErrorMessageInvalidPhoneNumber;
case FIRAuthErrorCodeMissingVerificationCode:
return kFIRAuthErrorMessageMissingVerificationCode;
case FIRAuthErrorCodeInvalidVerificationCode:
return kFIRAuthErrorMessageInvalidVerificationCode;
case FIRAuthErrorCodeMissingVerificationID:
return kFIRAuthErrorMessageMissingVerificationID;
case FIRAuthErrorCodeInvalidVerificationID:
return kFIRAuthErrorMessageInvalidVerificationID;
case FIRAuthErrorCodeSessionExpired:
return kFIRAuthErrorMessageSessionExpired;
case FIRAuthErrorCodeMissingAppCredential:
return kFIRAuthErrorMessageMissingAppCredential;
case FIRAuthErrorCodeInvalidAppCredential:
return kFIRAuthErrorMessageInvalidAppCredential;
case FIRAuthErrorCodeQuotaExceeded:
return kFIRAuthErrorMessageQuotaExceeded;
case FIRAuthErrorCodeMissingAppToken:
return kFIRAuthErrorMessageMissingAppToken;
case FIRAuthErrorCodeNotificationNotForwarded:
return kFIRAuthErrorMessageNotificationNotForwarded;
case FIRAuthErrorCodeAppNotVerified:
return kFIRAuthErrorMessageAppNotVerified;
2017-08-23 09:02:50 -07:00
case FIRAuthErrorCodeCaptchaCheckFailed:
return kFIRAuthErrorMessageCaptchaCheckFailed;
2017-09-01 13:38:12 -07:00
case FIRAuthErrorCodeWebContextAlreadyPresented:
return kFIRAuthErrorMessageWebContextAlreadyPresented;
case FIRAuthErrorCodeWebContextCancelled:
return kFIRAuthErrorMessageWebContextCancelled;
case FIRAuthErrorCodeInvalidClientID:
return kFIRAuthErrorMessageInvalidClientID;
case FIRAuthErrorCodeAppVerificationUserInteractionFailure:
return kFIRAuthErrorMessageAppVerificationUserInteractionFailure;
case FIRAuthErrorCodeWebNetworkRequestFailed:
return kFIRAuthErrorMessageWebRequestFailed;
2018-04-03 17:19:51 -07:00
case FIRAuthErrorCodeNullUser:
return kFIRAuthErrorMessageNullUser;
case FIRAuthErrorCodeInvalidProviderID:
return kFIRAuthErrorMessageInvalidProviderID;
2018-11-26 22:19:29 -08:00
case FIRAuthErrorCodeInvalidDynamicLinkDomain:
return kFIRAuthErrorMessageInvalidDynamicLinkDomain;
case FIRAuthErrorCodeWebInternalError:
return kFIRAuthErrorMessageWebInternalError;
2019-02-22 21:23:17 -08:00
case FIRAuthErrorCodeWebSignInUserInteractionFailure:
return kFIRAuthErrorMessageAppVerificationUserInteractionFailure;
2018-06-21 12:10:05 -07:00
case FIRAuthErrorCodeMalformedJWT:
return kFIRAuthErrorMessageMalformedJWT;
2018-11-30 17:30:22 -08:00
case FIRAuthErrorCodeLocalPlayerNotAuthenticated:
return kFIRAuthErrorMessageLocalPlayerNotAuthenticated;
2019-02-06 11:15:08 -08:00
case FIRAuthErrorCodeGameKitNotLinked:
return kFIRAuthErrorMessageGameKitNotLinked;
2020-03-10 13:30:20 -07:00
case FIRAuthErrorCodeSecondFactorRequired:
return kFIRAuthErrorMessageSecondFactorRequired;
case FIRAuthErrorCodeMissingMultiFactorSession:
return FIRAuthErrorMessageMissingMultiFactorSession;
case FIRAuthErrorCodeMissingMultiFactorInfo:
return FIRAuthErrorMessageMissingMultiFactorInfo;
case FIRAuthErrorCodeInvalidMultiFactorSession:
return FIRAuthErrorMessageInvalidMultiFactorSession;
case FIRAuthErrorCodeMultiFactorInfoNotFound:
return FIRAuthErrorMessageMultiFactorInfoNotFound;
case FIRAuthErrorCodeAdminRestrictedOperation:
return FIRAuthErrorMessageAdminRestrictedOperation;
case FIRAuthErrorCodeUnverifiedEmail:
return FIRAuthErrorMessageUnverifiedEmail;
case FIRAuthErrorCodeSecondFactorAlreadyEnrolled:
return FIRAuthErrorMessageSecondFactorAlreadyEnrolled;
case FIRAuthErrorCodeMaximumSecondFactorCountExceeded:
return FIRAuthErrorMessageMaximumSecondFactorCountExceeded;
case FIRAuthErrorCodeUnsupportedFirstFactor:
return FIRAuthErrorMessageUnsupportedFirstFactor;
case FIRAuthErrorCodeEmailChangeNeedsVerification:
return FIRAuthErrorMessageEmailChangeNeedsVerification;
case FIRAuthErrorCodeDynamicLinkNotActivated:
return kFIRAuthErrorMessageDynamicLinkNotActivated;
case FIRAuthErrorCodeRejectedCredential:
return kFIRAuthErrorMessageRejectedCredential;
case FIRAuthErrorCodeMissingOrInvalidNonce:
return kFIRAuthErrorMessageMissingOrInvalidNonce;
2020-08-17 17:25:27 -07:00
case FIRAuthErrorCodeTenantIDMismatch:
return kFIRAuthErrorMessageTenantIDMismatch;
case FIRAuthErrorCodeUnsupportedTenantOperation:
return kFIRAuthErrorMessageUnsupportedTenantOperation;
2017-05-15 12:27:07 -07:00
}
}
/** @var FIRAuthErrorCodeString
@brief The the error short string, based on the error code.
@remarks No default case so that we get a compiler warning if a new value was added to the enum.
*/
static NSString *const FIRAuthErrorCodeString(FIRAuthErrorCode code) {
switch (code) {
case FIRAuthErrorCodeInvalidCustomToken:
return @"ERROR_INVALID_CUSTOM_TOKEN";
case FIRAuthErrorCodeCustomTokenMismatch:
return @"ERROR_CUSTOM_TOKEN_MISMATCH";
case FIRAuthErrorCodeInvalidEmail:
return @"ERROR_INVALID_EMAIL";
case FIRAuthErrorCodeInvalidCredential:
return @"ERROR_INVALID_CREDENTIAL";
case FIRAuthErrorCodeUserDisabled:
return @"ERROR_USER_DISABLED";
case FIRAuthErrorCodeEmailAlreadyInUse:
return @"ERROR_EMAIL_ALREADY_IN_USE";
case FIRAuthErrorCodeWrongPassword:
return @"ERROR_WRONG_PASSWORD";
case FIRAuthErrorCodeTooManyRequests:
return @"ERROR_TOO_MANY_REQUESTS";
case FIRAuthErrorCodeAccountExistsWithDifferentCredential:
return @"ERROR_ACCOUNT_EXISTS_WITH_DIFFERENT_CREDENTIAL";
case FIRAuthErrorCodeRequiresRecentLogin:
return @"ERROR_REQUIRES_RECENT_LOGIN";
case FIRAuthErrorCodeProviderAlreadyLinked:
return @"ERROR_PROVIDER_ALREADY_LINKED";
case FIRAuthErrorCodeNoSuchProvider:
return @"ERROR_NO_SUCH_PROVIDER";
case FIRAuthErrorCodeInvalidUserToken:
return @"ERROR_INVALID_USER_TOKEN";
case FIRAuthErrorCodeNetworkError:
return @"ERROR_NETWORK_REQUEST_FAILED";
case FIRAuthErrorCodeKeychainError:
return @"ERROR_KEYCHAIN_ERROR";
case FIRAuthErrorCodeMissingClientIdentifier:
return @"ERROR_MISSING_CLIENT_IDENTIFIER";
2017-05-15 12:27:07 -07:00
case FIRAuthErrorCodeUserTokenExpired:
return @"ERROR_USER_TOKEN_EXPIRED";
case FIRAuthErrorCodeUserNotFound:
return @"ERROR_USER_NOT_FOUND";
case FIRAuthErrorCodeInvalidAPIKey:
return @"ERROR_INVALID_API_KEY";
case FIRAuthErrorCodeCredentialAlreadyInUse:
return @"ERROR_CREDENTIAL_ALREADY_IN_USE";
case FIRAuthErrorCodeInternalError:
return @"ERROR_INTERNAL_ERROR";
case FIRAuthErrorCodeUserMismatch:
return @"ERROR_USER_MISMATCH";
case FIRAuthErrorCodeOperationNotAllowed:
return @"ERROR_OPERATION_NOT_ALLOWED";
case FIRAuthErrorCodeWeakPassword:
return @"ERROR_WEAK_PASSWORD";
case FIRAuthErrorCodeAppNotAuthorized:
return @"ERROR_APP_NOT_AUTHORIZED";
case FIRAuthErrorCodeExpiredActionCode:
return @"ERROR_EXPIRED_ACTION_CODE";
case FIRAuthErrorCodeInvalidActionCode:
return @"ERROR_INVALID_ACTION_CODE";
case FIRAuthErrorCodeInvalidMessagePayload:
return @"ERROR_INVALID_MESSAGE_PAYLOAD";
case FIRAuthErrorCodeInvalidSender:
return @"ERROR_INVALID_SENDER";
case FIRAuthErrorCodeInvalidRecipientEmail:
return @"ERROR_INVALID_RECIPIENT_EMAIL";
2017-07-28 17:43:33 -07:00
case FIRAuthErrorCodeMissingIosBundleID:
return @"ERROR_MISSING_IOS_BUNDLE_ID";
case FIRAuthErrorCodeMissingAndroidPackageName:
return @"ERROR_MISSING_ANDROID_PKG_NAME";
case FIRAuthErrorCodeUnauthorizedDomain:
return @"ERROR_UNAUTHORIZED_DOMAIN";
case FIRAuthErrorCodeInvalidContinueURI:
return @"ERROR_INVALID_CONTINUE_URI";
case FIRAuthErrorCodeMissingContinueURI:
return @"ERROR_MISSING_CONTINUE_URI";
2017-06-01 18:12:09 -07:00
case FIRAuthErrorCodeMissingEmail:
return @"ERROR_MISSING_EMAIL";
2017-05-15 12:27:07 -07:00
case FIRAuthErrorCodeMissingPhoneNumber:
return @"ERROR_MISSING_PHONE_NUMBER";
case FIRAuthErrorCodeInvalidPhoneNumber:
return @"ERROR_INVALID_PHONE_NUMBER";
case FIRAuthErrorCodeMissingVerificationCode:
return @"ERROR_MISSING_VERIFICATION_CODE";
case FIRAuthErrorCodeInvalidVerificationCode:
return @"ERROR_INVALID_VERIFICATION_CODE";
case FIRAuthErrorCodeMissingVerificationID:
return @"ERROR_MISSING_VERIFICATION_ID";
case FIRAuthErrorCodeInvalidVerificationID:
return @"ERROR_INVALID_VERIFICATION_ID";
case FIRAuthErrorCodeSessionExpired:
return @"ERROR_SESSION_EXPIRED";
case FIRAuthErrorCodeMissingAppCredential:
return @"MISSING_APP_CREDENTIAL";
case FIRAuthErrorCodeInvalidAppCredential:
return @"INVALID_APP_CREDENTIAL";
case FIRAuthErrorCodeQuotaExceeded:
return @"ERROR_QUOTA_EXCEEDED";
case FIRAuthErrorCodeMissingAppToken:
return @"ERROR_MISSING_APP_TOKEN";
case FIRAuthErrorCodeNotificationNotForwarded:
return @"ERROR_NOTIFICATION_NOT_FORWARDED";
case FIRAuthErrorCodeAppNotVerified:
return @"ERROR_APP_NOT_VERIFIED";
2017-08-23 09:02:50 -07:00
case FIRAuthErrorCodeCaptchaCheckFailed:
return @"ERROR_CAPTCHA_CHECK_FAILED";
2017-09-01 13:38:12 -07:00
case FIRAuthErrorCodeWebContextAlreadyPresented:
return @"ERROR_WEB_CONTEXT_ALREADY_PRESENTED";
case FIRAuthErrorCodeWebContextCancelled:
return @"ERROR_WEB_CONTEXT_CANCELLED";
case FIRAuthErrorCodeInvalidClientID:
return @"ERROR_INVALID_CLIENT_ID";
case FIRAuthErrorCodeAppVerificationUserInteractionFailure:
return @"ERROR_APP_VERIFICATION_FAILED";
case FIRAuthErrorCodeWebNetworkRequestFailed:
return @"ERROR_WEB_NETWORK_REQUEST_FAILED";
2018-04-03 17:19:51 -07:00
case FIRAuthErrorCodeNullUser:
return @"ERROR_NULL_USER";
case FIRAuthErrorCodeInvalidProviderID:
return @"ERROR_INVALID_PROVIDER_ID";
2018-11-26 22:19:29 -08:00
case FIRAuthErrorCodeInvalidDynamicLinkDomain:
return @"ERROR_INVALID_DYNAMIC_LINK_DOMAIN";
case FIRAuthErrorCodeWebInternalError:
return @"ERROR_WEB_INTERNAL_ERROR";
2019-02-22 21:23:17 -08:00
case FIRAuthErrorCodeWebSignInUserInteractionFailure:
return @"ERROR_WEB_USER_INTERACTION_FAILURE";
2018-06-21 12:10:05 -07:00
case FIRAuthErrorCodeMalformedJWT:
return @"ERROR_MALFORMED_JWT";
2018-11-30 17:30:22 -08:00
case FIRAuthErrorCodeLocalPlayerNotAuthenticated:
return @"ERROR_LOCAL_PLAYER_NOT_AUTHENTICATED";
2019-02-06 11:15:08 -08:00
case FIRAuthErrorCodeGameKitNotLinked:
return @"ERROR_GAME_KIT_NOT_LINKED";
2020-03-10 13:30:20 -07:00
case FIRAuthErrorCodeSecondFactorRequired:
return @"ERROR_SECOND_FACTOR_REQUIRED";
case FIRAuthErrorCodeMissingMultiFactorSession:
return @"ERROR_MISSING_MULTI_FACTOR_SESSION";
case FIRAuthErrorCodeMissingMultiFactorInfo:
return @"ERROR_MISSING_MULTI_FACTOR_INFO";
case FIRAuthErrorCodeInvalidMultiFactorSession:
return @"ERROR_INVALID_MULTI_FACTOR_SESSION";
case FIRAuthErrorCodeMultiFactorInfoNotFound:
return @"ERROR_MULTI_FACTOR_INFO_NOT_FOUND";
case FIRAuthErrorCodeAdminRestrictedOperation:
return @"ERROR_ADMIN_RESTRICTED_OPERATION";
case FIRAuthErrorCodeUnverifiedEmail:
return @"ERROR_UNVERIFIED_EMAIL";
case FIRAuthErrorCodeSecondFactorAlreadyEnrolled:
return @"ERROR_SECOND_FACTOR_ALREADY_ENROLLED";
case FIRAuthErrorCodeMaximumSecondFactorCountExceeded:
return @"ERROR_MAXIMUM_SECOND_FACTOR_COUNT_EXCEEDED";
case FIRAuthErrorCodeUnsupportedFirstFactor:
return @"ERROR_UNSUPPORTED_FIRST_FACTOR";
case FIRAuthErrorCodeEmailChangeNeedsVerification:
return @"ERROR_EMAIL_CHANGE_NEEDS_VERIFICATION";
case FIRAuthErrorCodeDynamicLinkNotActivated:
return @"ERROR_DYNAMIC_LINK_NOT_ACTIVATED";
case FIRAuthErrorCodeRejectedCredential:
return @"ERROR_REJECTED_CREDENTIAL";
case FIRAuthErrorCodeMissingOrInvalidNonce:
return @"ERROR_MISSING_OR_INVALID_NONCE";
2020-08-17 17:25:27 -07:00
case FIRAuthErrorCodeTenantIDMismatch:
return @"ERROR_TENANT_ID_MISMATCH";
case FIRAuthErrorCodeUnsupportedTenantOperation:
return @"ERROR_UNSUPPORTED_TENANT_OPERATION";
2017-05-15 12:27:07 -07:00
}
}
@implementation FIRAuthErrorUtils
+ (NSError *)errorWithCode:(FIRAuthInternalErrorCode)code {
return [self errorWithCode:code message:nil];
}
2020-03-17 10:22:29 -07:00
+ (NSError *)errorWithCode:(FIRAuthInternalErrorCode)code message:(nullable NSString *)message {
2017-05-15 12:27:07 -07:00
NSDictionary *userInfo = nil;
if (message.length) {
2020-03-17 10:22:29 -07:00
userInfo = @{NSLocalizedDescriptionKey : message};
2017-05-15 12:27:07 -07:00
}
return [self errorWithCode:code userInfo:userInfo];
}
+ (NSError *)errorWithCode:(FIRAuthInternalErrorCode)code
underlyingError:(nullable NSError *)underlyingError {
2019-02-22 21:23:17 -08:00
NSDictionary *errorUserInfo;
2017-05-15 12:27:07 -07:00
if (underlyingError) {
2020-03-17 10:22:29 -07:00
errorUserInfo = @{NSUnderlyingErrorKey : underlyingError};
2017-05-15 12:27:07 -07:00
}
return [self errorWithCode:code userInfo:errorUserInfo];
}
2018-08-24 07:09:56 -07:00
+ (NSError *)errorWithCode:(FIRAuthInternalErrorCode)code
userInfo:(nullable NSDictionary *)userInfo {
2017-05-15 12:27:07 -07:00
BOOL isPublic = (code & FIRAuthPublicErrorCodeFlag) == FIRAuthPublicErrorCodeFlag;
if (isPublic) {
// This is a public error. Return it as a public error and add a description.
NSInteger errorCode = code & ~FIRAuthPublicErrorCodeFlag;
NSMutableDictionary *errorUserInfo = [NSMutableDictionary dictionary];
if (userInfo) {
[errorUserInfo addEntriesFromDictionary:userInfo];
}
2017-05-15 12:27:07 -07:00
if (!errorUserInfo[NSLocalizedDescriptionKey]) {
errorUserInfo[NSLocalizedDescriptionKey] = FIRAuthErrorDescription(errorCode);
}
2019-02-22 21:23:17 -08:00
errorUserInfo[FIRAuthErrorUserInfoNameKey] = FIRAuthErrorCodeString(errorCode);
2017-05-15 12:27:07 -07:00
return [NSError errorWithDomain:FIRAuthErrorDomain code:errorCode userInfo:errorUserInfo];
} else {
// This is an internal error. Wrap it in an internal error.
2020-03-17 10:22:29 -07:00
NSError *error = [NSError errorWithDomain:FIRAuthInternalErrorDomain
code:code
userInfo:userInfo];
2017-05-15 12:27:07 -07:00
return [self errorWithCode:FIRAuthInternalErrorCodeInternalError underlyingError:error];
}
}
+ (NSError *)RPCRequestEncodingErrorWithUnderlyingError:(NSError *)underlyingError {
return [self errorWithCode:FIRAuthInternalErrorCodeRPCRequestEncodingError
underlyingError:underlyingError];
}
+ (NSError *)JSONSerializationErrorForUnencodableType {
return [self errorWithCode:FIRAuthInternalErrorCodeJSONSerializationError];
}
+ (NSError *)JSONSerializationErrorWithUnderlyingError:(NSError *)underlyingError {
return [self errorWithCode:FIRAuthInternalErrorCodeJSONSerializationError
underlyingError:underlyingError];
}
+ (NSError *)networkErrorWithUnderlyingError:(NSError *)underlyingError {
2020-03-17 10:22:29 -07:00
return [self errorWithCode:FIRAuthInternalErrorCodeNetworkError underlyingError:underlyingError];
2017-05-15 12:27:07 -07:00
}
+ (NSError *)unexpectedErrorResponseWithData:(NSData *)data
underlyingError:(NSError *)underlyingError {
2019-02-22 21:23:17 -08:00
NSMutableDictionary *userInfo = [NSMutableDictionary dictionary];
if (data) {
userInfo[FIRAuthErrorUserInfoDataKey] = data;
}
if (underlyingError) {
userInfo[NSUnderlyingErrorKey] = underlyingError;
}
return [self errorWithCode:FIRAuthInternalErrorCodeUnexpectedErrorResponse
userInfo:[userInfo copy]];
2017-05-15 12:27:07 -07:00
}
+ (NSError *)unexpectedErrorResponseWithDeserializedResponse:(id)deserializedResponse {
2019-02-22 21:23:17 -08:00
NSDictionary *userInfo;
if (deserializedResponse) {
userInfo = @{
FIRAuthErrorUserInfoDeserializedResponseKey : deserializedResponse,
};
}
return [self errorWithCode:FIRAuthInternalErrorCodeUnexpectedErrorResponse userInfo:userInfo];
2017-05-15 12:27:07 -07:00
}
2018-06-21 12:10:05 -07:00
+ (NSError *)malformedJWTErrorWithToken:(NSString *)token
underlyingError:(NSError *_Nullable)underlyingError {
NSMutableDictionary *userInfo =
[NSMutableDictionary dictionaryWithObject:kFIRAuthErrorMessageMalformedJWT
forKey:NSLocalizedDescriptionKey];
[userInfo setObject:token forKey:FIRAuthErrorUserInfoDataKey];
if (underlyingError != nil) {
[userInfo setObject:underlyingError forKey:NSUnderlyingErrorKey];
}
return [self errorWithCode:FIRAuthInternalErrorCodeMalformedJWT userInfo:[userInfo copy]];
}
2020-03-17 10:22:29 -07:00
+ (NSError *)unexpectedResponseWithData:(NSData *)data underlyingError:(NSError *)underlyingError {
2019-02-22 21:23:17 -08:00
NSMutableDictionary *userInfo = [NSMutableDictionary dictionary];
if (data) {
userInfo[FIRAuthErrorUserInfoDataKey] = data;
}
if (underlyingError) {
userInfo[NSUnderlyingErrorKey] = underlyingError;
}
return [self errorWithCode:FIRAuthInternalErrorCodeUnexpectedResponse userInfo:[userInfo copy]];
2017-05-15 12:27:07 -07:00
}
+ (NSError *)unexpectedResponseWithDeserializedResponse:(id)deserializedResponse {
2019-02-22 21:23:17 -08:00
NSDictionary *userInfo;
2017-05-15 12:27:07 -07:00
if (deserializedResponse) {
2019-02-22 21:23:17 -08:00
userInfo = @{
FIRAuthErrorUserInfoDeserializedResponseKey : deserializedResponse,
};
2017-05-15 12:27:07 -07:00
}
return [self errorWithCode:FIRAuthInternalErrorCodeUnexpectedResponse userInfo:userInfo];
}
2019-02-22 21:23:17 -08:00
+ (NSError *)unexpectedResponseWithDeserializedResponse:(nullable id)deserializedResponse
underlyingError:(NSError *)underlyingError {
NSMutableDictionary *userInfo = [NSMutableDictionary dictionary];
if (deserializedResponse) {
userInfo[FIRAuthErrorUserInfoDeserializedResponseKey] = deserializedResponse;
}
if (underlyingError) {
userInfo[NSUnderlyingErrorKey] = underlyingError;
}
return [self errorWithCode:FIRAuthInternalErrorCodeUnexpectedResponse userInfo:[userInfo copy]];
}
2017-05-15 12:27:07 -07:00
+ (NSError *)RPCResponseDecodingErrorWithDeserializedResponse:(id)deserializedResponse
underlyingError:(NSError *)underlyingError {
2019-02-22 21:23:17 -08:00
NSMutableDictionary *userInfo = [NSMutableDictionary dictionary];
if (deserializedResponse) {
userInfo[FIRAuthErrorUserInfoDeserializedResponseKey] = deserializedResponse;
}
if (underlyingError) {
userInfo[NSUnderlyingErrorKey] = underlyingError;
}
return [self errorWithCode:FIRAuthInternalErrorCodeRPCResponseDecodingError
userInfo:[userInfo copy]];
2017-05-15 12:27:07 -07:00
}
+ (NSError *)emailAlreadyInUseErrorWithEmail:(nullable NSString *)email {
2019-02-22 21:23:17 -08:00
NSDictionary *userInfo;
2017-05-15 12:27:07 -07:00
if (email.length) {
2019-02-22 21:23:17 -08:00
userInfo = @{
FIRAuthErrorUserInfoEmailKey : email,
};
2017-05-15 12:27:07 -07:00
}
return [self errorWithCode:FIRAuthInternalErrorCodeEmailAlreadyInUse userInfo:userInfo];
}
+ (NSError *)userDisabledErrorWithMessage:(nullable NSString *)message {
return [self errorWithCode:FIRAuthInternalErrorCodeUserDisabled message:message];
}
+ (NSError *)wrongPasswordErrorWithMessage:(nullable NSString *)message {
return [self errorWithCode:FIRAuthInternalErrorCodeWrongPassword message:message];
}
+ (NSError *)tooManyRequestsErrorWithMessage:(nullable NSString *)message {
return [self errorWithCode:FIRAuthInternalErrorCodeTooManyRequests message:message];
}
+ (NSError *)invalidCustomTokenErrorWithMessage:(nullable NSString *)message {
return [self errorWithCode:FIRAuthInternalErrorCodeInvalidCustomToken message:message];
}
+ (NSError *)customTokenMistmatchErrorWithMessage:(nullable NSString *)message {
return [self errorWithCode:FIRAuthInternalErrorCodeCustomTokenMismatch message:message];
}
+ (NSError *)invalidCredentialErrorWithMessage:(nullable NSString *)message {
return [self errorWithCode:FIRAuthInternalErrorCodeInvalidCredential message:message];
}
+ (NSError *)requiresRecentLoginErrorWithMessage:(nullable NSString *)message {
return [self errorWithCode:FIRAuthInternalErrorCodeRequiresRecentLogin message:message];
}
+ (NSError *)invalidUserTokenErrorWithMessage:(nullable NSString *)message {
return [self errorWithCode:FIRAuthInternalErrorCodeInvalidUserToken message:message];
}
+ (NSError *)invalidEmailErrorWithMessage:(nullable NSString *)message {
return [self errorWithCode:FIRAuthInternalErrorCodeInvalidEmail message:message];
}
+ (NSError *)accountExistsWithDifferentCredentialErrorWithEmail:(nullable NSString *)email
2020-03-17 10:22:29 -07:00
updatedCredential:
(nullable FIRAuthCredential *)updatedCredential {
NSMutableDictionary *userInfo = [NSMutableDictionary dictionary];
if (email) {
userInfo[FIRAuthErrorUserInfoEmailKey] = email;
}
if (updatedCredential) {
userInfo[FIRAuthErrorUserInfoUpdatedCredentialKey] = updatedCredential;
2019-02-22 21:23:17 -08:00
}
2017-05-15 12:27:07 -07:00
return [self errorWithCode:FIRAuthInternalErrorCodeAccountExistsWithDifferentCredential
2019-02-22 21:23:17 -08:00
userInfo:userInfo];
2017-05-15 12:27:07 -07:00
}
+ (NSError *)providerAlreadyLinkedError {
return [self errorWithCode:FIRAuthInternalErrorCodeProviderAlreadyLinked];
}
+ (NSError *)noSuchProviderError {
return [self errorWithCode:FIRAuthInternalErrorCodeNoSuchProvider];
}
+ (NSError *)userTokenExpiredErrorWithMessage:(nullable NSString *)message {
return [self errorWithCode:FIRAuthInternalErrorCodeUserTokenExpired message:message];
}
+ (NSError *)userNotFoundErrorWithMessage:(nullable NSString *)message {
return [self errorWithCode:FIRAuthInternalErrorCodeUserNotFound message:message];
}
+ (NSError *)invalidAPIKeyError {
return [self errorWithCode:FIRAuthInternalErrorCodeInvalidAPIKey];
}
+ (NSError *)userMismatchError {
return [self errorWithCode:FIRAuthInternalErrorCodeUserMismatch];
}
+ (NSError *)credentialAlreadyInUseErrorWithMessage:(nullable NSString *)message
2019-02-22 21:23:17 -08:00
credential:(nullable FIRAuthCredential *)credential
email:(nullable NSString *)email {
NSMutableDictionary *userInfo = [NSMutableDictionary dictionary];
2017-05-15 12:27:07 -07:00
if (credential) {
2019-02-22 21:23:17 -08:00
userInfo[FIRAuthErrorUserInfoUpdatedCredentialKey] = credential;
}
if (email.length) {
userInfo[FIRAuthErrorUserInfoEmailKey] = email;
}
if (userInfo.count) {
2020-03-17 10:22:29 -07:00
return [self errorWithCode:FIRAuthInternalErrorCodeCredentialAlreadyInUse userInfo:userInfo];
2017-05-15 12:27:07 -07:00
}
return [self errorWithCode:FIRAuthInternalErrorCodeCredentialAlreadyInUse message:message];
}
+ (NSError *)operationNotAllowedErrorWithMessage:(nullable NSString *)message {
return [self errorWithCode:FIRAuthInternalErrorCodeOperationNotAllowed message:message];
}
2018-08-30 06:41:30 -07:00
+ (NSError *)weakPasswordErrorWithServerResponseReason:(nullable NSString *)reason {
2019-02-22 21:23:17 -08:00
NSDictionary *userInfo;
if (reason.length) {
userInfo = @{
NSLocalizedFailureReasonErrorKey : reason,
};
}
return [self errorWithCode:FIRAuthInternalErrorCodeWeakPassword userInfo:userInfo];
2017-05-15 12:27:07 -07:00
}
+ (NSError *)appNotAuthorizedError {
return [self errorWithCode:FIRAuthInternalErrorCodeAppNotAuthorized];
}
+ (NSError *)expiredActionCodeErrorWithMessage:(nullable NSString *)message {
return [self errorWithCode:FIRAuthInternalErrorCodeExpiredActionCode message:message];
}
+ (NSError *)invalidActionCodeErrorWithMessage:(nullable NSString *)message {
return [self errorWithCode:FIRAuthInternalErrorCodeInvalidActionCode message:message];
}
+ (NSError *)invalidMessagePayloadErrorWithMessage:(nullable NSString *)message {
return [self errorWithCode:FIRAuthInternalErrorCodeInvalidMessagePayload message:message];
}
+ (NSError *)invalidSenderErrorWithMessage:(nullable NSString *)message {
return [self errorWithCode:FIRAuthInternalErrorCodeInvalidSender message:message];
}
+ (NSError *)invalidRecipientEmailErrorWithMessage:(nullable NSString *)message {
return [self errorWithCode:FIRAuthInternalErrorCodeInvalidRecipientEmail message:message];
}
2017-07-28 17:43:33 -07:00
+ (NSError *)missingIosBundleIDErrorWithMessage:(nullable NSString *)message {
return [self errorWithCode:FIRAuthinternalErrorCodeMissingIosBundleID message:message];
}
+ (NSError *)missingAndroidPackageNameErrorWithMessage:(nullable NSString *)message {
return [self errorWithCode:FIRAuthInternalErrorCodeMissingAndroidPackageName message:message];
}
+ (NSError *)unauthorizedDomainErrorWithMessage:(nullable NSString *)message {
return [self errorWithCode:FIRAuthInternalErrorCodeUnauthorizedDomain message:message];
}
+ (NSError *)invalidContinueURIErrorWithMessage:(nullable NSString *)message {
return [self errorWithCode:FIRAuthInternalErrorCodeInvalidContinueURI message:message];
}
+ (NSError *)missingContinueURIErrorWithMessage:(nullable NSString *)message {
2020-03-17 10:22:29 -07:00
return [self errorWithCode:FIRAuthInternalErrorCodeMissingContinueURI message:message];
2017-07-28 17:43:33 -07:00
}
+ (NSError *)missingEmailErrorWithMessage:(nullable NSString *)message {
return [self errorWithCode:FIRAuthInternalErrorCodeMissingEmail message:message];
2017-06-01 18:12:09 -07:00
}
2017-05-15 12:27:07 -07:00
+ (NSError *)missingPhoneNumberErrorWithMessage:(nullable NSString *)message {
return [self errorWithCode:FIRAuthInternalErrorCodeMissingPhoneNumber message:message];
}
+ (NSError *)invalidPhoneNumberErrorWithMessage:(nullable NSString *)message {
return [self errorWithCode:FIRAuthInternalErrorCodeInvalidPhoneNumber message:message];
}
+ (NSError *)missingVerificationCodeErrorWithMessage:(nullable NSString *)message {
return [self errorWithCode:FIRAuthInternalErrorCodeMissingVerificationCode message:message];
}
+ (NSError *)invalidVerificationCodeErrorWithMessage:(nullable NSString *)message {
return [self errorWithCode:FIRAuthInternalErrorCodeInvalidVerificationCode message:message];
}
+ (NSError *)missingVerificationIDErrorWithMessage:(nullable NSString *)message {
return [self errorWithCode:FIRAuthInternalErrorCodeMissingVerificationID message:message];
}
+ (NSError *)invalidVerificationIDErrorWithMessage:(nullable NSString *)message {
return [self errorWithCode:FIRAuthInternalErrorCodeInvalidVerificationID message:message];
}
+ (NSError *)sessionExpiredErrorWithMessage:(nullable NSString *)message {
return [self errorWithCode:FIRAuthInternalErrorCodeSessionExpired message:message];
}
+ (NSError *)missingAppCredentialWithMessage:(nullable NSString *)message {
return [self errorWithCode:FIRAuthInternalErrorCodeMissingAppCredential message:message];
}
+ (NSError *)invalidAppCredentialWithMessage:(nullable NSString *)message {
return [self errorWithCode:FIRAuthInternalErrorCodeInvalidAppCredential message:message];
}
+ (NSError *)quotaExceededErrorWithMessage:(nullable NSString *)message {
return [self errorWithCode:FIRAuthInternalErrorCodeQuotaExceeded message:message];
}
+ (NSError *)missingAppTokenErrorWithUnderlyingError:(nullable NSError *)underlyingError {
return [self errorWithCode:FIRAuthInternalErrorCodeMissingAppToken
underlyingError:underlyingError];
2017-05-15 12:27:07 -07:00
}
2018-11-30 17:30:22 -08:00
+ (NSError *)localPlayerNotAuthenticatedError {
return [self errorWithCode:FIRAuthInternalErrorCodeLocalPlayerNotAuthenticated];
}
2019-02-06 11:15:08 -08:00
+ (NSError *)gameKitNotLinkedError {
return [self errorWithCode:FIRAuthInternalErrorCodeGameKitNotLinked];
}
2020-03-10 13:30:20 -07:00
#if TARGET_OS_IOS
2020-03-11 10:15:27 -07:00
+ (NSError *)secondFactorRequiredErrorWithPendingCredential:(NSString *)MFAPendingCredential
2020-03-10 13:30:20 -07:00
hints:(NSArray<FIRMultiFactorInfo *> *)hints {
NSMutableDictionary *userInfo = [NSMutableDictionary dictionary];
2020-03-11 10:15:27 -07:00
if (MFAPendingCredential && hints) {
2020-03-17 10:22:29 -07:00
FIRMultiFactorResolver *resolver =
[[FIRMultiFactorResolver alloc] initWithMFAPendingCredential:MFAPendingCredential
hints:hints];
2020-03-10 13:30:20 -07:00
userInfo[FIRAuthErrorUserInfoMultiFactorResolverKey] = resolver;
}
return [self errorWithCode:FIRAuthInternalErrorCodeSecondFactorRequired userInfo:userInfo];
}
#endif
2017-05-15 12:27:07 -07:00
+ (NSError *)notificationNotForwardedError {
return [self errorWithCode:FIRAuthInternalErrorCodeNotificationNotForwarded];
}
+ (NSError *)appNotVerifiedErrorWithMessage:(nullable NSString *)message {
return [self errorWithCode:FIRAuthInternalErrorCodeAppNotVerified message:message];
}
+ (NSError *)missingClientIdentifierErrorWithMessage:(nullable NSString *)message {
return [self errorWithCode:FIRAuthInternalErrorCodeMissingClientIdentifier message:message];
}
2017-08-23 09:02:50 -07:00
+ (NSError *)captchaCheckFailedErrorWithMessage:(nullable NSString *)message {
return [self errorWithCode:FIRAuthInternalErrorCodeCaptchaCheckFailed message:message];
}
2017-09-01 13:38:12 -07:00
+ (NSError *)webContextAlreadyPresentedErrorWithMessage:(nullable NSString *)message {
return [self errorWithCode:FIRAuthInternalErrorCodeWebContextAlreadyPresented message:message];
}
+ (NSError *)webContextCancelledErrorWithMessage:(nullable NSString *)message {
return [self errorWithCode:FIRAuthInternalErrorCodeWebContextCancelled message:message];
}
+ (NSError *)appVerificationUserInteractionFailureWithReason:(NSString *)reason {
2019-02-22 21:23:17 -08:00
NSDictionary *userInfo;
if (reason.length) {
userInfo = @{
NSLocalizedFailureReasonErrorKey : reason,
};
}
return [self errorWithCode:FIRAuthInternalErrorCodeAppVerificationUserInteractionFailure
2019-02-22 21:23:17 -08:00
userInfo:userInfo];
}
+ (NSError *)webSignInUserInteractionFailureWithReason:(nullable NSString *)reason {
NSDictionary *userInfo;
if (reason.length) {
userInfo = @{
NSLocalizedFailureReasonErrorKey : reason,
};
}
return [self errorWithCode:FIRAuthInternalErrorCodeWebSignInUserInteractionFailure
userInfo:userInfo];
}
2020-03-17 10:22:29 -07:00
+ (nullable NSError *)URLResponseErrorWithCode:(NSString *)code
message:(nullable NSString *)message {
if ([code isEqualToString:kURLResponseErrorCodeInvalidClientID]) {
return [self errorWithCode:FIRAuthInternalErrorCodeInvalidClientID message:message];
}
if ([code isEqualToString:kURLResponseErrorCodeNetworkRequestFailed]) {
return [self errorWithCode:FIRAuthInternalErrorCodeWebNetworkRequestFailed message:message];
}
if ([code isEqualToString:kURLResponseErrorCodeInternalError]) {
return [self errorWithCode:FIRAuthInternalErrorCodeWebInternalError message:message];
}
return nil;
}
2018-04-03 17:19:51 -07:00
+ (NSError *)nullUserErrorWithMessage:(nullable NSString *)message {
return [self errorWithCode:FIRAuthInternalErrorCodeNullUser message:message];
}
+ (NSError *)invalidProviderIDErrorWithMessage:(nullable NSString *)message {
return [self errorWithCode:FIRAuthInternalErrorCodeInvalidProviderID message:message];
}
2018-11-26 22:19:29 -08:00
+ (NSError *)invalidDynamicLinkDomainErrorWithMessage:(nullable NSString *)message {
return [self errorWithCode:FIRAuthInternalErrorCodeInvalidDynamicLinkDomain message:message];
}
+ (NSError *)missingOrInvalidNonceErrorWithMessage:(nullable NSString *)message {
return [self errorWithCode:FIRAuthInternalErrorCodeMissingOrInvalidNonce message:message];
}
2017-05-15 12:27:07 -07:00
+ (NSError *)keychainErrorWithFunction:(NSString *)keychainFunction status:(OSStatus)status {
NSString *failureReason = [NSString stringWithFormat:@"%@ (%li)", keychainFunction, (long)status];
2020-03-17 10:22:29 -07:00
return [self errorWithCode:FIRAuthInternalErrorCodeKeychainError
userInfo:@{
NSLocalizedFailureReasonErrorKey : failureReason,
}];
2017-05-15 12:27:07 -07:00
}
2020-08-17 17:25:27 -07:00
+ (NSError *)tenantIDMismatchError {
return [self errorWithCode:FIRAuthInternalErrorCodeTenantIDMismatch];
}
+ (NSError *)unsupportedTenantOperationError {
return [self errorWithCode:FIRAuthInternalErrorCodeUnsupportedTenantOperation];
}
2017-05-15 12:27:07 -07:00
@end
NS_ASSUME_NONNULL_END