| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522 |
- /*
- * 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.
- */
- #import "FirebaseAuth/Sources/Utilities/FIRAuthErrorUtils.h"
- #import "FirebaseAuth/Sources/Public/FirebaseAuth/FIRAuthCredential.h"
- #import "FirebaseAuth/Sources/MultiFactor/FIRMultiFactorResolver+Internal.h"
- NS_ASSUME_NONNULL_BEGIN
- NSString *const FIRAuthErrorDomain = @"FIRAuthErrorDomain";
- NSString *const FIRAuthInternalErrorDomain = @"FIRAuthInternalErrorDomain";
- NSString *const FIRAuthErrorUserInfoDeserializedResponseKey =
- @"FIRAuthErrorUserInfoDeserializedResponseKey";
- NSString *const FIRAuthErrorUserInfoDataKey = @"FIRAuthErrorUserInfoDataKey";
- NSString *const FIRAuthErrorUserInfoEmailKey = @"FIRAuthErrorUserInfoEmailKey";
- NSString *const FIRAuthErrorUserInfoUpdatedCredentialKey =
- @"FIRAuthErrorUserInfoUpdatedCredentialKey";
- NSString *const FIRAuthErrorUserInfoNameKey = @"FIRAuthErrorUserInfoNameKey";
- NSString *const FIRAuthErrorUserInfoMultiFactorResolverKey =
- @"FIRAuthErrorUserInfoMultiFactorResolverKey";
- /** @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
- @brief Error code that indicates that an internal error occurred within the
- SFSafariViewController or WKWebView failed.
- */
- static NSString *const kURLResponseErrorCodeInternalError = @"auth/internal-error";
- #pragma mark - Standard Error Messages
- /** @var kFIRAuthErrorMessageInvalidCustomToken
- @brief Message for @c FIRAuthErrorCodeInvalidCustomToken error code.
- */
- static NSString *const kFIRAuthErrorMessageInvalidCustomToken =
- @"The custom token format is "
- "incorrect. Please check the documentation.";
- /** @var kFIRAuthErrorMessageCustomTokenMismatch
- @brief Message for @c FIRAuthErrorCodeCustomTokenMismatch error code.
- */
- static NSString *const kFIRAuthErrorMessageCustomTokenMismatch = @"The custom token corresponds to "
- "a different audience or issuer.";
- /** @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 "
- "malformed or has expired.";
- /** @var kFIRAuthErrorMessageUserDisabled
- @brief Message for @c FIRAuthErrorCodeUserDisabled error code.
- */
- static NSString *const kFIRAuthErrorMessageUserDisabled = @"The user account has been disabled by "
- "an administrator.";
- /** @var kFIRAuthErrorMessageEmailAlreadyInUse
- @brief Message for @c FIRAuthErrorCodeEmailAlreadyInUse error code.
- */
- static NSString *const kFIRAuthErrorMessageEmailAlreadyInUse = @"The email address is already in "
- "use by another account.";
- /** @var kFIRAuthErrorMessageWrongPassword
- @brief Message for @c FIRAuthErrorCodeWrongPassword error code.
- */
- static NSString *const kFIRAuthErrorMessageWrongPassword = @"The password is invalid or the user "
- "does not have a password.";
- /** @var kFIRAuthErrorMessageTooManyRequests
- @brief Message for @c FIRAuthErrorCodeTooManyRequests error code.
- */
- static NSString *const kFIRAuthErrorMessageTooManyRequests =
- @"We have blocked all requests from "
- "this device due to unusual activity. Try again later.";
- /** @var kFIRAuthErrorMessageAccountExistsWithDifferentCredential
- @brief Message for @c FIRAuthErrorCodeAccountExistsWithDifferentCredential error code.
- */
- 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.";
- /** @var kFIRAuthErrorMessageRequiresRecentLogin
- @brief Message for @c FIRAuthErrorCodeRequiresRecentLogin error code.
- */
- static NSString *const kFIRAuthErrorMessageRequiresRecentLogin =
- @"This operation is sensitive and "
- "requires recent authentication. Log in again before retrying this request.";
- /** @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 "
- "provider.";
- /** @var kFIRAuthErrorMessageNoSuchProvider
- @brief Message for @c FIRAuthErrorCodeNoSuchProvider error code.
- */
- static NSString *const kFIRAuthErrorMessageNoSuchProvider = @"User was not linked to an account "
- "with the given provider.";
- /** @var kFIRAuthErrorMessageInvalidUserToken
- @brief Message for @c FIRAuthErrorCodeInvalidUserToken error code.
- */
- 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.";
- /** @var kFIRAuthErrorMessageNetworkError
- @brief Message for @c FIRAuthErrorCodeNetworkError error code.
- */
- static NSString *const kFIRAuthErrorMessageNetworkError =
- @"Network error (such as timeout, "
- "interrupted connection or unreachable host) has occurred.";
- /** @var kFIRAuthErrorMessageKeychainError
- @brief Message for @c FIRAuthErrorCodeKeychainError error code.
- */
- static NSString *const kFIRAuthErrorMessageKeychainError =
- @"An error occurred when accessing the "
- "keychain. The NSLocalizedFailureReasonErrorKey field in the NSError.userInfo dictionary "
- "will contain more information about the error encountered";
- /** @var kFIRAuthErrorMessageUserTokenExpired
- @brief Message for @c FIRAuthErrorCodeTokenExpired error code.
- */
- static NSString *const kFIRAuthErrorMessageUserTokenExpired =
- @"The user's credential is no longer "
- "valid. The user must sign in again.";
- /** @var kFIRAuthErrorMessageUserNotFound
- @brief Message for @c FIRAuthErrorCodeUserNotFound error code.
- */
- static NSString *const kFIRAuthErrorMessageUserNotFound =
- @"There is no user record corresponding "
- "to this identifier. The user may have been deleted.";
- /** @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 "
- "the request.";
- /** @var kFIRAuthErrorMessageUserMismatch.
- @brief Message for @c FIRAuthErrorCodeInvalidAPIKey error code.
- */
- static NSString *const FIRAuthErrorMessageUserMismatch =
- @"The supplied credentials do not "
- "correspond to the previously signed in user.";
- /** @var kFIRAuthErrorMessageCredentialAlreadyInUse
- @brief Message for @c FIRAuthErrorCodeCredentialAlreadyInUse error code.
- */
- static NSString *const kFIRAuthErrorMessageCredentialAlreadyInUse =
- @"This credential is already "
- "associated with a different user account.";
- /** @var kFIRAuthErrorMessageOperationNotAllowed
- @brief Message for @c FIRAuthErrorCodeOperationNotAllowed error code.
- */
- 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.";
- /** @var kFIRAuthErrorMessageWeakPassword
- @brief Message for @c FIRAuthErrorCodeWeakPassword error code.
- */
- static NSString *const kFIRAuthErrorMessageWeakPassword = @"The password must be 6 characters long "
- "or more.";
- /** @var kFIRAuthErrorMessageAppNotAuthorized
- @brief Message for @c FIRAuthErrorCodeAppNotAuthorized error code.
- */
- 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.";
- /** @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.
- */
- static NSString *const kFIRAuthErrorMessageInvalidActionCode =
- @"The action code is invalid. This "
- "can happen if the code is malformed, expired, or has already been used.";
- /** @var kFIRAuthErrorMessageInvalidMessagePayload
- @brief Message for @c FIRAuthErrorCodeInvalidMessagePayload error code.
- */
- static NSString *const kFIRAuthErrorMessageInvalidMessagePayload =
- @"The action code is invalid. "
- "This can happen if the code is malformed, expired, or has already been used.";
- /** @var kFIRAuthErrorMessageInvalidSender
- @brief Message for @c FIRAuthErrorCodeInvalidSender error code.
- */
- 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.";
- /** @var kFIRAuthErrorMessageInvalidRecipientEmail
- @brief Message for @c FIRAuthErrorCodeInvalidRecipient error code.
- */
- static NSString *const kFIRAuthErrorMessageInvalidRecipientEmail =
- @"The action code is invalid. "
- "This can happen if the code is malformed, expired, or has already been used.";
- /** @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.
- */
- static NSString *const kFIRAuthErrorMessageUnauthorizedDomain =
- @"The domain of the continue URL "
- "is not allowlisted. Please allowlist the domain in the Firebase console.";
- /** @var kFIRAuthErrorMessageInvalidContinueURI
- @brief Message for @c FIRAuthErrorCodeInvalidContinueURI error code.
- */
- static NSString *const kFIRAuthErrorMessageInvalidContinueURI =
- @"The continue URL provided in the request is invalid.";
- /** @var kFIRAuthErrorMessageMissingEmail
- @brief Message for @c FIRAuthErrorCodeMissingEmail error code.
- */
- static NSString *const kFIRAuthErrorMessageMissingEmail = @"An email address must be provided.";
- /** @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.
- */
- static NSString *const kFIRAuthErrorMessageInvalidPhoneNumber =
- @"The format of the phone number provided is incorrect. Please enter the phone number in a "
- "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].";
- /** @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.";
- /** @var kFIRAuthErrorMessageInvalidVerificationCode
- @brief Message for @c FIRAuthErrorCodeInvalidVerificationCode error code.
- */
- static NSString *const kFIRAuthErrorMessageInvalidVerificationCode =
- @"The multifactor verification code used to create the auth credential is invalid."
- @"Re-collect the verification code and be sure to use the verification code provided by the "
- @"user.";
- /** @var kFIRAuthErrorMessageMissingVerificationID
- @brief Message for @c FIRAuthErrorCodeInvalidVerificationID error code.
- */
- static NSString *const kFIRAuthErrorMessageMissingVerificationID =
- @"The phone auth credential was created with an empty verification ID.";
- /** @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.";
- /** @var kFIRAuthErrorMessageLocalPlayerNotAuthenticated
- @brief Message for @c FIRAuthErrorCodeLocalPlayerNotAuthenticated error code.
- */
- static NSString *const kFIRAuthErrorMessageLocalPlayerNotAuthenticated =
- @"The local player is not authenticated. Please log the local player in to Game Center.";
- /** @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.";
- /** @var kFIRAuthErrorMessageSessionExpired
- @brief Message for @c FIRAuthErrorCodeSessionExpired error code.
- */
- static NSString *const kFIRAuthErrorMessageSessionExpired =
- @"The SMS code has expired. Please "
- @"re-send the verification code to try again.";
- /** @var kFIRAuthErrorMessageMissingAppCredential
- @brief Message for @c FIRAuthErrorCodeMissingAppCredential error code.
- */
- 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.";
- /** @var kFIRAuthErrorMessageInvalidAppCredential
- @brief Message for @c FIRAuthErrorCodeInvalidAppCredential error code.
- */
- static NSString *const kFIRAuthErrorMessageInvalidAppCredential =
- @"The APNs device token provided "
- "is either incorrect or does not match the private certificate uploaded to the Firebase "
- "Console.";
- /** @var kFIRAuthErrorMessageQuotaExceeded
- @brief Message for @c FIRAuthErrorCodeQuotaExceeded error code.
- */
- static NSString *const kFIRAuthErrorMessageQuotaExceeded = @"The quota for this operation "
- "has been exceeded.";
- /** @var kFIRAuthErrorMessageMissingAppToken
- @brief Message for @c FIRAuthErrorCodeMissingAppToken error code.
- */
- 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";
- /** @var kFIRAuthErrorMessageMissingAppToken
- @brief Message for @c FIRAuthErrorCodeMissingAppToken error code.
- */
- static NSString *const kFIRAuthErrorMessageNotificationNotForwarded =
- @"If app delegate swizzling "
- "is disabled, remote notifications received by UIApplicationDelegate need to be forwarded to "
- "FIRAuth's canHandleNotificaton: method.";
- /** @var kFIRAuthErrorMessageAppNotVerified
- @brief Message for @c FIRAuthErrorCodeMissingAppToken error code.
- */
- 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.";
- /** @var kFIRAuthErrorMessageCaptchaCheckFailed
- @brief Message for @c FIRAuthErrorCodeCaptchaCheckFailed error code.
- */
- static NSString *const kFIRAuthErrorMessageCaptchaCheckFailed =
- @"The reCAPTCHA response token "
- "provided is either invalid, expired or already";
- /** @var kFIRAuthErrorMessageWebContextAlreadyPresented
- @brief Message for @c FIRAuthErrorCodeWebContextAlreadyPresented error code.
- */
- static NSString *const kFIRAuthErrorMessageWebContextAlreadyPresented =
- @"User interaction is "
- "still ongoing, another view cannot be presented.";
- /** @var kFIRAuthErrorMessageWebContextCancelled
- @brief Message for @c FIRAuthErrorCodeWebContextCancelled error code.
- */
- static NSString *const kFIRAuthErrorMessageWebContextCancelled = @"The interaction was cancelled "
- "by the user.";
- /** @var kFIRAuthErrorMessageInvalidClientID
- @brief Message for @c FIRAuthErrorCodeInvalidClientID error code.
- */
- 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.
- */
- 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.
- */
- static NSString *const kFIRAuthErrorMessageWebInternalError =
- @"An internal error has occurred "
- "within the SFSafariViewController or WKWebView.";
- /** @var kFIRAuthErrorMessageAppVerificationUserInteractionFailure
- @brief Message for @c FIRAuthErrorCodeInvalidClientID error code.
- */
- static NSString *const kFIRAuthErrorMessageAppVerificationUserInteractionFailure =
- @"The app "
- "verification process has failed, print and inspect the error details for more information";
- /** @var kFIRAuthErrorMessageNullUser
- @brief Message for @c FIRAuthErrorCodeNullUser error code.
- */
- static NSString *const kFIRAuthErrorMessageNullUser =
- @"A null user object was provided as the "
- "argument for an operation which requires a non-null user object.";
- /** @var kFIRAuthErrorMessageInvalidProviderID
- @brief Message for @c FIRAuthErrorCodeInvalidProviderID error code.
- */
- static NSString *const kFIRAuthErrorMessageInvalidProviderID =
- @"The provider ID provided for the "
- "attempted web operation is invalid.";
- /** @var kFIRAuthErrorMessageInvalidDynamicLinkDomain
- @brief Message for @c kFIRAuthErrorMessageInvalidDynamicLinkDomain error code.
- */
- static NSString *const kFIRAuthErrorMessageInvalidDynamicLinkDomain =
- @"The "
- "Firebase Dynamic Link domain used is either not configured or is unauthorized "
- "for the current project.";
- /** @var kFIRAuthErrorMessageInternalError
- @brief Message for @c FIRAuthErrorCodeInternalError error code.
- */
- static NSString *const kFIRAuthErrorMessageInternalError =
- @"An internal error has occurred, "
- "print and inspect the error details for more information.";
- /** @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.";
- /** @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 =
- @"The request is missing proof of first factor successful sign-in.";
- /** @var kFIRAuthErrorMessageSecondFactorRequired
- @brief Message for @c kFIRAuthErrorMessageSecondFactorRequired error code.
- */
- static NSString *const FIRAuthErrorMessageMissingMultiFactorInfo =
- @"No second factor identifier is provided.";
- /** @var kFIRAuthErrorMessageSecondFactorRequired
- @brief Message for @c kFIRAuthErrorMessageSecondFactorRequired error code.
- */
- static NSString *const FIRAuthErrorMessageInvalidMultiFactorSession =
- @"The request does not contain a valid proof of first factor successful sign-in.";
- /** @var kFIRAuthErrorMessageSecondFactorRequired
- @brief Message for @c kFIRAuthErrorMessageSecondFactorRequired error code.
- */
- static NSString *const FIRAuthErrorMessageMultiFactorInfoNotFound =
- @"The user does not have a second factor matching the identifier provided.";
- /** @var kFIRAuthErrorMessageSecondFactorRequired
- @brief Message for @c kFIRAuthErrorMessageSecondFactorRequired error code.
- */
- static NSString *const FIRAuthErrorMessageAdminRestrictedOperation =
- @"This operation is restricted to administrators only.";
- /** @var kFIRAuthErrorMessageSecondFactorRequired
- @brief Message for @c kFIRAuthErrorMessageSecondFactorRequired error code.
- */
- static NSString *const FIRAuthErrorMessageUnverifiedEmail =
- @"The operation requires a verified email.";
- /** @var kFIRAuthErrorMessageSecondFactorRequired
- @brief Message for @c kFIRAuthErrorMessageSecondFactorRequired error code.
- */
- static NSString *const FIRAuthErrorMessageSecondFactorAlreadyEnrolled =
- @"The second factor is already enrolled on this account.";
- /** @var kFIRAuthErrorMessageSecondFactorRequired
- @brief Message for @c kFIRAuthErrorMessageSecondFactorRequired error code.
- */
- static NSString *const FIRAuthErrorMessageMaximumSecondFactorCountExceeded =
- @"The maximum allowed number of second factors on a user has been exceeded.";
- /** @var kFIRAuthErrorMessageSecondFactorRequired
- @brief Message for @c kFIRAuthErrorMessageSecondFactorRequired error code.
- */
- static NSString *const FIRAuthErrorMessageUnsupportedFirstFactor =
- @"Enrolling a second factor or signing in with a multi-factor account requires sign-in with a "
- @"supported first factor.";
- /** @var kFIRAuthErrorMessageSecondFactorRequired
- @brief Message for @c kFIRAuthErrorMessageSecondFactorRequired error code.
- */
- static NSString *const FIRAuthErrorMessageEmailChangeNeedsVerification =
- @"Multi-factor users must always have a verified email.";
- /** @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 kFIRAuthErrorMessageMissingClientIdentifier
- @brief Error message constant describing @c FIRAuthErrorCodeMissingClientIdentifier errors.
- */
- static NSString *const kFIRAuthErrorMessageMissingClientIdentifier =
- @"The request does not contain a client identifier.";
- /** @var kFIRAuthErrorMessageMissingOrInvalidNonce
- @brief Error message constant describing @c FIRAuthErrorCodeMissingOrInvalidNonce errors.
- */
- static NSString *const kFIRAuthErrorMessageMissingOrInvalidNonce =
- @"The request contains malformed or mismatched credentials.";
- /** @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.";
- /** @var kFIRAuthErrorMessageBlockingCloudFunctionReturnedError
- @brief Message for @c FIRAuthErrorCodeBlockingCloudFunctionError error code.
- */
- static NSString *const kFIRAuthErrorMessageBlockingCloudFunctionReturnedError =
- @"Blocking cloud function returned an error.";
- static NSString *const kFIRAuthErrorMessageRecaptchaNotEnabled =
- @"reCAPTCHA Enterprise is not enabled for this project.";
- static NSString *const kFIRAuthErrorMessageMissingRecaptchaToken =
- @"The backend request is missing the reCAPTCHA verification token.";
- static NSString *const kFIRAuthErrorMessageInvalidRecaptchaToken =
- @"The reCAPTCHA verification token is invalid or has expired.";
- static NSString *const kFIRAuthErrorMessageInvalidRecaptchaAction =
- @"The reCAPTCHA verification failed due to an invalid action.";
- static NSString *const kFIRAuthErrorMessageMissingClientType =
- @"The request is missing a client type or the client type is invalid.";
- static NSString *const kFIRAuthErrorMessageMissingRecaptchaVersion =
- @"The request is missing the reCAPTCHA version parameter.";
- static NSString *const kFIRAuthErrorMessageInvalidRecaptchaVersion =
- @"The request specifies an invalid version of reCAPTCHA.";
- static NSString *const kFIRAuthErrorMessageInvalidReqType =
- @"The request is not supported or is invalid.";
- // TODO(chuanr): point the link to GCIP doc once available.
- static NSString *const kFIRAuthErrorMessageRecaptchaSDKNotLinked =
- @"The reCAPTCHA SDK is not linked to your app. See "
- @"https://cloud.google.com/recaptcha-enterprise/docs/instrument-ios-apps";
- /** @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 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;
- case FIRAuthErrorCodeMissingIosBundleID:
- return kFIRAuthErrorMessageMissingIosBundleID;
- case FIRAuthErrorCodeMissingAndroidPackageName:
- return kFIRAuthErrorMessageMissingAndroidPackageName;
- case FIRAuthErrorCodeUnauthorizedDomain:
- return kFIRAuthErrorMessageUnauthorizedDomain;
- case FIRAuthErrorCodeInvalidContinueURI:
- return kFIRAuthErrorMessageInvalidContinueURI;
- case FIRAuthErrorCodeMissingContinueURI:
- return kFIRAuthErrorMessageMissingContinueURI;
- case FIRAuthErrorCodeMissingEmail:
- return kFIRAuthErrorMessageMissingEmail;
- 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;
- case FIRAuthErrorCodeCaptchaCheckFailed:
- return kFIRAuthErrorMessageCaptchaCheckFailed;
- case FIRAuthErrorCodeWebContextAlreadyPresented:
- return kFIRAuthErrorMessageWebContextAlreadyPresented;
- case FIRAuthErrorCodeWebContextCancelled:
- return kFIRAuthErrorMessageWebContextCancelled;
- case FIRAuthErrorCodeInvalidClientID:
- return kFIRAuthErrorMessageInvalidClientID;
- case FIRAuthErrorCodeAppVerificationUserInteractionFailure:
- return kFIRAuthErrorMessageAppVerificationUserInteractionFailure;
- case FIRAuthErrorCodeWebNetworkRequestFailed:
- return kFIRAuthErrorMessageWebRequestFailed;
- case FIRAuthErrorCodeNullUser:
- return kFIRAuthErrorMessageNullUser;
- case FIRAuthErrorCodeInvalidProviderID:
- return kFIRAuthErrorMessageInvalidProviderID;
- case FIRAuthErrorCodeInvalidDynamicLinkDomain:
- return kFIRAuthErrorMessageInvalidDynamicLinkDomain;
- case FIRAuthErrorCodeWebInternalError:
- return kFIRAuthErrorMessageWebInternalError;
- case FIRAuthErrorCodeWebSignInUserInteractionFailure:
- return kFIRAuthErrorMessageAppVerificationUserInteractionFailure;
- case FIRAuthErrorCodeMalformedJWT:
- return kFIRAuthErrorMessageMalformedJWT;
- case FIRAuthErrorCodeLocalPlayerNotAuthenticated:
- return kFIRAuthErrorMessageLocalPlayerNotAuthenticated;
- case FIRAuthErrorCodeGameKitNotLinked:
- return kFIRAuthErrorMessageGameKitNotLinked;
- 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 FIRAuthErrorCodeMissingClientIdentifier:
- return kFIRAuthErrorMessageMissingClientIdentifier;
- case FIRAuthErrorCodeMissingOrInvalidNonce:
- return kFIRAuthErrorMessageMissingOrInvalidNonce;
- case FIRAuthErrorCodeTenantIDMismatch:
- return kFIRAuthErrorMessageTenantIDMismatch;
- case FIRAuthErrorCodeUnsupportedTenantOperation:
- return kFIRAuthErrorMessageUnsupportedTenantOperation;
- case FIRAuthErrorCodeBlockingCloudFunctionError:
- return kFIRAuthErrorMessageBlockingCloudFunctionReturnedError;
- case FIRAuthErrorCodeRecaptchaNotEnabled:
- return kFIRAuthErrorMessageRecaptchaNotEnabled;
- case FIRAuthErrorCodeMissingRecaptchaToken:
- return kFIRAuthErrorMessageMissingRecaptchaToken;
- case FIRAuthErrorCodeInvalidRecaptchaToken:
- return kFIRAuthErrorMessageInvalidRecaptchaToken;
- case FIRAuthErrorCodeInvalidRecaptchaAction:
- return kFIRAuthErrorMessageInvalidRecaptchaAction;
- case FIRAuthErrorCodeMissingClientType:
- return kFIRAuthErrorMessageMissingClientType;
- case FIRAuthErrorCodeMissingRecaptchaVersion:
- return kFIRAuthErrorMessageMissingRecaptchaVersion;
- case FIRAuthErrorCodeInvalidRecaptchaVersion:
- return kFIRAuthErrorMessageInvalidRecaptchaVersion;
- case FIRAuthErrorCodeInvalidReqType:
- return kFIRAuthErrorMessageInvalidReqType;
- case FIRAuthErrorCodeRecaptchaSDKNotLinked:
- return kFIRAuthErrorMessageRecaptchaSDKNotLinked;
- }
- }
- /** @var FIRAuthErrorCodeString
- @brief 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 FIRAuthErrorCodeMissingClientType:
- return @"ERROR_MISSING_CLIENT_TYPE";
- 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";
- 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";
- case FIRAuthErrorCodeMissingEmail:
- return @"ERROR_MISSING_EMAIL";
- 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";
- case FIRAuthErrorCodeCaptchaCheckFailed:
- return @"ERROR_CAPTCHA_CHECK_FAILED";
- 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";
- case FIRAuthErrorCodeNullUser:
- return @"ERROR_NULL_USER";
- case FIRAuthErrorCodeInvalidProviderID:
- return @"ERROR_INVALID_PROVIDER_ID";
- case FIRAuthErrorCodeInvalidDynamicLinkDomain:
- return @"ERROR_INVALID_DYNAMIC_LINK_DOMAIN";
- case FIRAuthErrorCodeWebInternalError:
- return @"ERROR_WEB_INTERNAL_ERROR";
- case FIRAuthErrorCodeWebSignInUserInteractionFailure:
- return @"ERROR_WEB_USER_INTERACTION_FAILURE";
- case FIRAuthErrorCodeMalformedJWT:
- return @"ERROR_MALFORMED_JWT";
- case FIRAuthErrorCodeLocalPlayerNotAuthenticated:
- return @"ERROR_LOCAL_PLAYER_NOT_AUTHENTICATED";
- case FIRAuthErrorCodeGameKitNotLinked:
- return @"ERROR_GAME_KIT_NOT_LINKED";
- 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 FIRAuthErrorCodeMissingClientIdentifier:
- return @"ERROR_MISSING_CLIENT_IDENTIFIER";
- case FIRAuthErrorCodeMissingOrInvalidNonce:
- return @"ERROR_MISSING_OR_INVALID_NONCE";
- case FIRAuthErrorCodeTenantIDMismatch:
- return @"ERROR_TENANT_ID_MISMATCH";
- case FIRAuthErrorCodeUnsupportedTenantOperation:
- return @"ERROR_UNSUPPORTED_TENANT_OPERATION";
- case FIRAuthErrorCodeBlockingCloudFunctionError:
- return @"ERROR_BLOCKING_CLOUD_FUNCTION_RETURNED_ERROR";
- case FIRAuthErrorCodeRecaptchaNotEnabled:
- return @"ERROR_RECAPTCHA_NOT_ENABLED";
- case FIRAuthErrorCodeMissingRecaptchaToken:
- return @"ERROR_MISSING_RECAPTCHA_TOKEN";
- case FIRAuthErrorCodeInvalidRecaptchaToken:
- return @"ERROR_INVALID_RECAPTCHA_TOKEN";
- case FIRAuthErrorCodeInvalidRecaptchaAction:
- return @"ERROR_INVALID_RECAPTCHA_ACTION";
- case FIRAuthErrorCodeMissingRecaptchaVersion:
- return @"ERROR_MISSING_RECAPTCHA_VERSION";
- case FIRAuthErrorCodeInvalidRecaptchaVersion:
- return @"ERROR_INVALID_RECAPTCHA_VERSION";
- case FIRAuthErrorCodeInvalidReqType:
- return @"ERROR_INVALID_REQ_TYPE";
- case FIRAuthErrorCodeRecaptchaSDKNotLinked:
- return @"ERROR_RECAPTCHA_SDK_NOT_LINKED";
- }
- }
- @implementation FIRAuthErrorUtils
- + (NSError *)errorWithCode:(FIRAuthInternalErrorCode)code {
- return [self errorWithCode:code message:nil];
- }
- + (NSError *)errorWithCode:(FIRAuthInternalErrorCode)code message:(nullable NSString *)message {
- NSDictionary *userInfo = nil;
- if (message.length) {
- userInfo = @{NSLocalizedDescriptionKey : message};
- }
- return [self errorWithCode:code userInfo:userInfo];
- }
- + (NSError *)errorWithCode:(FIRAuthInternalErrorCode)code
- underlyingError:(nullable NSError *)underlyingError {
- NSDictionary *errorUserInfo;
- if (underlyingError) {
- errorUserInfo = @{NSUnderlyingErrorKey : underlyingError};
- }
- return [self errorWithCode:code userInfo:errorUserInfo];
- }
- + (NSError *)errorWithCode:(FIRAuthInternalErrorCode)code
- userInfo:(nullable NSDictionary *)userInfo {
- 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];
- }
- if (!errorUserInfo[NSLocalizedDescriptionKey]) {
- errorUserInfo[NSLocalizedDescriptionKey] = FIRAuthErrorDescription(errorCode);
- }
- errorUserInfo[FIRAuthErrorUserInfoNameKey] = FIRAuthErrorCodeString(errorCode);
- return [NSError errorWithDomain:FIRAuthErrorDomain code:errorCode userInfo:errorUserInfo];
- } else {
- // This is an internal error. Wrap it in an internal error.
- NSError *error = [NSError errorWithDomain:FIRAuthInternalErrorDomain
- code:code
- userInfo:userInfo];
- 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 {
- return [self errorWithCode:FIRAuthInternalErrorCodeNetworkError underlyingError:underlyingError];
- }
- + (NSError *)unexpectedErrorResponseWithData:(NSData *)data
- underlyingError:(NSError *)underlyingError {
- NSMutableDictionary *userInfo = [NSMutableDictionary dictionary];
- if (data) {
- userInfo[FIRAuthErrorUserInfoDataKey] = data;
- }
- if (underlyingError) {
- userInfo[NSUnderlyingErrorKey] = underlyingError;
- }
- return [self errorWithCode:FIRAuthInternalErrorCodeUnexpectedErrorResponse
- userInfo:[userInfo copy]];
- }
- + (NSError *)unexpectedErrorResponseWithDeserializedResponse:(id)deserializedResponse {
- NSDictionary *userInfo;
- if (deserializedResponse) {
- userInfo = @{
- FIRAuthErrorUserInfoDeserializedResponseKey : deserializedResponse,
- };
- }
- return [self errorWithCode:FIRAuthInternalErrorCodeUnexpectedErrorResponse userInfo:userInfo];
- }
- + (NSError *)unexpectedErrorResponseWithDeserializedResponse:(id)deserializedResponse
- underlyingError:(NSError *)underlyingError {
- NSMutableDictionary *userInfo = [NSMutableDictionary dictionary];
- if (deserializedResponse) {
- userInfo[FIRAuthErrorUserInfoDeserializedResponseKey] = deserializedResponse;
- }
- if (underlyingError) {
- userInfo[NSUnderlyingErrorKey] = underlyingError;
- }
- return [self errorWithCode:FIRAuthInternalErrorCodeUnexpectedErrorResponse
- userInfo:[userInfo copy]];
- }
- + (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]];
- }
- + (NSError *)unexpectedResponseWithData:(NSData *)data underlyingError:(NSError *)underlyingError {
- NSMutableDictionary *userInfo = [NSMutableDictionary dictionary];
- if (data) {
- userInfo[FIRAuthErrorUserInfoDataKey] = data;
- }
- if (underlyingError) {
- userInfo[NSUnderlyingErrorKey] = underlyingError;
- }
- return [self errorWithCode:FIRAuthInternalErrorCodeUnexpectedResponse userInfo:[userInfo copy]];
- }
- + (NSError *)unexpectedResponseWithDeserializedResponse:(id)deserializedResponse {
- NSDictionary *userInfo;
- if (deserializedResponse) {
- userInfo = @{
- FIRAuthErrorUserInfoDeserializedResponseKey : deserializedResponse,
- };
- }
- return [self errorWithCode:FIRAuthInternalErrorCodeUnexpectedResponse userInfo:userInfo];
- }
- + (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]];
- }
- + (NSError *)RPCResponseDecodingErrorWithDeserializedResponse:(id)deserializedResponse
- underlyingError:(NSError *)underlyingError {
- NSMutableDictionary *userInfo = [NSMutableDictionary dictionary];
- if (deserializedResponse) {
- userInfo[FIRAuthErrorUserInfoDeserializedResponseKey] = deserializedResponse;
- }
- if (underlyingError) {
- userInfo[NSUnderlyingErrorKey] = underlyingError;
- }
- return [self errorWithCode:FIRAuthInternalErrorCodeRPCResponseDecodingError
- userInfo:[userInfo copy]];
- }
- + (NSError *)emailAlreadyInUseErrorWithEmail:(nullable NSString *)email {
- NSDictionary *userInfo;
- if (email.length) {
- userInfo = @{
- FIRAuthErrorUserInfoEmailKey : email,
- };
- }
- 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
- updatedCredential:
- (nullable FIRAuthCredential *)updatedCredential {
- NSMutableDictionary *userInfo = [NSMutableDictionary dictionary];
- if (email) {
- userInfo[FIRAuthErrorUserInfoEmailKey] = email;
- }
- if (updatedCredential) {
- userInfo[FIRAuthErrorUserInfoUpdatedCredentialKey] = updatedCredential;
- }
- return [self errorWithCode:FIRAuthInternalErrorCodeAccountExistsWithDifferentCredential
- userInfo:userInfo];
- }
- + (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
- credential:(nullable FIRAuthCredential *)credential
- email:(nullable NSString *)email {
- NSMutableDictionary *userInfo = [NSMutableDictionary dictionary];
- if (credential) {
- userInfo[FIRAuthErrorUserInfoUpdatedCredentialKey] = credential;
- }
- if (email.length) {
- userInfo[FIRAuthErrorUserInfoEmailKey] = email;
- }
- if (userInfo.count) {
- return [self errorWithCode:FIRAuthInternalErrorCodeCredentialAlreadyInUse userInfo:userInfo];
- }
- return [self errorWithCode:FIRAuthInternalErrorCodeCredentialAlreadyInUse message:message];
- }
- + (NSError *)operationNotAllowedErrorWithMessage:(nullable NSString *)message {
- return [self errorWithCode:FIRAuthInternalErrorCodeOperationNotAllowed message:message];
- }
- + (NSError *)weakPasswordErrorWithServerResponseReason:(nullable NSString *)reason {
- NSDictionary *userInfo;
- if (reason.length) {
- userInfo = @{
- NSLocalizedFailureReasonErrorKey : reason,
- };
- }
- return [self errorWithCode:FIRAuthInternalErrorCodeWeakPassword userInfo:userInfo];
- }
- + (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];
- }
- + (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 {
- return [self errorWithCode:FIRAuthInternalErrorCodeMissingContinueURI message:message];
- }
- + (NSError *)missingEmailErrorWithMessage:(nullable NSString *)message {
- return [self errorWithCode:FIRAuthInternalErrorCodeMissingEmail message:message];
- }
- + (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];
- }
- + (NSError *)localPlayerNotAuthenticatedError {
- return [self errorWithCode:FIRAuthInternalErrorCodeLocalPlayerNotAuthenticated];
- }
- + (NSError *)gameKitNotLinkedError {
- return [self errorWithCode:FIRAuthInternalErrorCodeGameKitNotLinked];
- }
- #if TARGET_OS_IOS
- + (NSError *)secondFactorRequiredErrorWithPendingCredential:(NSString *)MFAPendingCredential
- hints:(NSArray<FIRMultiFactorInfo *> *)hints
- auth:(FIRAuth *)auth {
- NSMutableDictionary *userInfo = [NSMutableDictionary dictionary];
- if (MFAPendingCredential && hints) {
- FIRMultiFactorResolver *resolver =
- [[FIRMultiFactorResolver alloc] initWithMFAPendingCredential:MFAPendingCredential
- hints:hints
- auth:auth];
- userInfo[FIRAuthErrorUserInfoMultiFactorResolverKey] = resolver;
- }
- return [self errorWithCode:FIRAuthInternalErrorCodeSecondFactorRequired userInfo:userInfo];
- }
- #endif
- + (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];
- }
- + (NSError *)missingClientTypeErrorWithMessage:(nullable NSString *)message {
- return [self errorWithCode:FIRAuthInternalErrorCodeMissingClientType message:message];
- }
- + (NSError *)captchaCheckFailedErrorWithMessage:(nullable NSString *)message {
- return [self errorWithCode:FIRAuthInternalErrorCodeCaptchaCheckFailed message:message];
- }
- + (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 {
- NSDictionary *userInfo;
- if (reason.length) {
- userInfo = @{
- NSLocalizedFailureReasonErrorKey : reason,
- };
- }
- return [self errorWithCode:FIRAuthInternalErrorCodeAppVerificationUserInteractionFailure
- userInfo:userInfo];
- }
- + (NSError *)webSignInUserInteractionFailureWithReason:(nullable NSString *)reason {
- NSDictionary *userInfo;
- if (reason.length) {
- userInfo = @{
- NSLocalizedFailureReasonErrorKey : reason,
- };
- }
- return [self errorWithCode:FIRAuthInternalErrorCodeWebSignInUserInteractionFailure
- userInfo:userInfo];
- }
- + (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;
- }
- + (NSError *)nullUserErrorWithMessage:(nullable NSString *)message {
- return [self errorWithCode:FIRAuthInternalErrorCodeNullUser message:message];
- }
- + (NSError *)invalidProviderIDErrorWithMessage:(nullable NSString *)message {
- return [self errorWithCode:FIRAuthInternalErrorCodeInvalidProviderID message:message];
- }
- + (NSError *)invalidDynamicLinkDomainErrorWithMessage:(nullable NSString *)message {
- return [self errorWithCode:FIRAuthInternalErrorCodeInvalidDynamicLinkDomain message:message];
- }
- + (NSError *)missingOrInvalidNonceErrorWithMessage:(nullable NSString *)message {
- return [self errorWithCode:FIRAuthInternalErrorCodeMissingOrInvalidNonce message:message];
- }
- + (NSError *)keychainErrorWithFunction:(NSString *)keychainFunction status:(OSStatus)status {
- NSString *failureReason = [NSString stringWithFormat:@"%@ (%li)", keychainFunction, (long)status];
- return [self errorWithCode:FIRAuthInternalErrorCodeKeychainError
- userInfo:@{
- NSLocalizedFailureReasonErrorKey : failureReason,
- }];
- }
- + (NSError *)tenantIDMismatchError {
- return [self errorWithCode:FIRAuthInternalErrorCodeTenantIDMismatch];
- }
- + (NSError *)unsupportedTenantOperationError {
- return [self errorWithCode:FIRAuthInternalErrorCodeUnsupportedTenantOperation];
- }
- + (NSError *)blockingCloudFunctionServerResponseWithMessage:(nullable NSString *)message {
- if (message == nil) {
- return [self errorWithCode:FIRAuthInternalErrorBlockingCloudFunctionError message:message];
- }
- NSString *jsonString =
- [message stringByReplacingOccurrencesOfString:@"HTTP Cloud Function returned an error:"
- withString:@""];
- jsonString = [jsonString stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]];
- NSData *jsonData = [jsonString dataUsingEncoding:NSUTF8StringEncoding];
- NSError *jsonError;
- NSDictionary *jsonDict = [NSJSONSerialization JSONObjectWithData:jsonData
- options:0
- error:&jsonError];
- if (jsonError) {
- return [self JSONSerializationErrorWithUnderlyingError:jsonError];
- }
- NSDictionary *errorDict = jsonDict[@"error"];
- NSString *errorMessage = errorDict[@"message"];
- return [self errorWithCode:FIRAuthInternalErrorBlockingCloudFunctionError message:errorMessage];
- }
- + (NSError *)recaptchaSDKNotLinkedError {
- return [self errorWithCode:FIRAuthInternalErrorCodeRecaptchaSDKNotLinked
- message:kFIRAuthErrorMessageRecaptchaSDKNotLinked];
- }
- @end
- NS_ASSUME_NONNULL_END
|