AuthErrors.swift 47 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221
  1. // Copyright 2023 Google LLC
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. import Foundation
  15. /*
  16. @remarks Error Codes common to all API Methods:
  17. + `FIRAuthErrorCodeNetworkError`
  18. + `FIRAuthErrorCodeUserNotFound`
  19. + `FIRAuthErrorCodeUserTokenExpired`
  20. + `FIRAuthErrorCodeTooManyRequests`
  21. + `FIRAuthErrorCodeInvalidAPIKey`
  22. + `FIRAuthErrorCodeAppNotAuthorized`
  23. + `FIRAuthErrorCodeKeychainError`
  24. + `FIRAuthErrorCodeInternalError`
  25. @remarks Common error codes for `FIRUser` operations:
  26. + `FIRAuthErrorCodeInvalidUserToken`
  27. + `FIRAuthErrorCodeUserDisabled`
  28. */
  29. // TODO: Keep the original global strings as deprecated, at least for CocoaPods, like we do in Storage.
  30. @objc(FIRAuthErrors) public class AuthErrors: NSObject {
  31. @objc public static let domain: String = "FIRAuthErrorDomain"
  32. @objc public static let userInfoNameKey: String = "FIRAuthErrorUserInfoNameKey"
  33. /**
  34. @brief Errors with one of the following three codes:
  35. - `FIRAuthErrorCodeAccountExistsWithDifferentCredential`
  36. - `FIRAuthErrorCodeCredentialAlreadyInUse`
  37. - `FIRAuthErrorCodeEmailAlreadyInUse`
  38. may contain an `NSError.userInfo` dictinary object which contains this key. The value
  39. associated with this key is an NSString of the email address of the account that already
  40. exists.
  41. */
  42. @objc public static let userInfoEmailKey: String = "FIRAuthErrorUserInfoEmailKey"
  43. /**
  44. @brief The key used to read the updated Auth credential from the userInfo dictionary of the
  45. NSError object returned. This is the updated auth credential the developer should use for
  46. recovery if applicable.
  47. */
  48. @objc public static let userInfoUpdatedCredentialKey: String =
  49. "FIRAuthErrorUserInfoUpdatedCredentialKey"
  50. /**
  51. @brief The key used to read the MFA resolver from the userInfo dictionary of the NSError object
  52. returned when 2FA is required for sign-incompletion.
  53. */
  54. @objc(FIRAuthErrorUserInfoMultiFactorResolverKey)
  55. public static let userInfoMultiFactorResolverKey: String =
  56. "FIRAuthErrorUserInfoMultiFactorResolverKey"
  57. }
  58. @objc(FIRAuthErrorCode) public enum AuthErrorCode: Int {
  59. /** Indicates a validation error with the custom token.
  60. */
  61. case invalidCustomToken = 17000
  62. /** Indicates the service account and the API key belong to different projects.
  63. */
  64. case customTokenMismatch = 17002
  65. /** Indicates the IDP token or requestUri is invalid.
  66. */
  67. case invalidCredential = 17004
  68. /** Indicates the user's account is disabled on the server.
  69. */
  70. case userDisabled = 17005
  71. /** Indicates the administrator disabled sign in with the specified identity provider.
  72. */
  73. case operationNotAllowed = 17006
  74. /** Indicates the email used to attempt a sign up is already in use.
  75. */
  76. case emailAlreadyInUse = 17007
  77. /** Indicates the email is invalid.
  78. */
  79. case invalidEmail = 17008
  80. /** Indicates the user attempted sign in with a wrong password.
  81. */
  82. case wrongPassword = 17009
  83. /** Indicates that too many requests were made to a server method.
  84. */
  85. case tooManyRequests = 17010
  86. /** Indicates the user account was not found.
  87. */
  88. case userNotFound = 17011
  89. /** Indicates account linking is required.
  90. */
  91. case accountExistsWithDifferentCredential = 17012
  92. /** Indicates the user has attemped to change email or password more than 5 minutes after
  93. signing in.
  94. */
  95. case requiresRecentLogin = 17014
  96. /** Indicates an attempt to link a provider to which the account is already linked.
  97. */
  98. case providerAlreadyLinked = 17015
  99. /** Indicates an attempt to unlink a provider that is not linked.
  100. */
  101. case noSuchProvider = 17016
  102. /** Indicates user's saved auth credential is invalid the user needs to sign in again.
  103. */
  104. case invalidUserToken = 17017
  105. /** Indicates a network error occurred (such as a timeout interrupted connection or
  106. unreachable host). These types of errors are often recoverable with a retry. The
  107. `NSUnderlyingError` field in the `NSError.userInfo` dictionary will contain the error
  108. encountered.
  109. */
  110. case networkError = 17020
  111. /** Indicates the saved token has expired for example the user may have changed account
  112. password on another device. The user needs to sign in again on the device that made this
  113. request.
  114. */
  115. case userTokenExpired = 17021
  116. /** Indicates an invalid API key was supplied in the request.
  117. */
  118. case invalidAPIKey = 17023
  119. /** Indicates that an attempt was made to reauthenticate with a user which is not the current
  120. user.
  121. */
  122. case userMismatch = 17024
  123. /** Indicates an attempt to link with a credential that has already been linked with a
  124. different Firebase account
  125. */
  126. case credentialAlreadyInUse = 17025
  127. /** Indicates an attempt to set a password that is considered too weak.
  128. */
  129. case weakPassword = 17026
  130. /** Indicates the App is not authorized to use Firebase Authentication with the
  131. provided API Key.
  132. */
  133. case appNotAuthorized = 17028
  134. /** Indicates the OOB code is expired.
  135. */
  136. case expiredActionCode = 17029
  137. /** Indicates the OOB code is invalid.
  138. */
  139. case invalidActionCode = 17030
  140. /** Indicates that there are invalid parameters in the payload during a "send password reset
  141. * email" attempt.
  142. */
  143. case invalidMessagePayload = 17031
  144. /** Indicates that the sender email is invalid during a "send password reset email" attempt.
  145. */
  146. case invalidSender = 17032
  147. /** Indicates that the recipient email is invalid.
  148. */
  149. case invalidRecipientEmail = 17033
  150. /** Indicates that an email address was expected but one was not provided.
  151. */
  152. case missingEmail = 17034
  153. // The enum values 17035 is reserved and should NOT be used for new error codes.
  154. /** Indicates that the iOS bundle ID is missing when a iOS App Store ID is provided.
  155. */
  156. case missingIosBundleID = 17036
  157. /** Indicates that the android package name is missing when the `androidInstallApp` flag is set
  158. to true.
  159. */
  160. case missingAndroidPackageName = 17037
  161. /** Indicates that the domain specified in the continue URL is not allowlisted in the Firebase
  162. console.
  163. */
  164. case unauthorizedDomain = 17038
  165. /** Indicates that the domain specified in the continue URI is not valid.
  166. */
  167. case invalidContinueURI = 17039
  168. /** Indicates that a continue URI was not provided in a request to the backend which requires
  169. one.
  170. */
  171. case missingContinueURI = 17040
  172. /** Indicates that a phone number was not provided in a call to
  173. `verifyPhoneNumber:completion:`.
  174. */
  175. case missingPhoneNumber = 17041
  176. /** Indicates that an invalid phone number was provided in a call to
  177. `verifyPhoneNumber:completion:`.
  178. */
  179. case invalidPhoneNumber = 17042
  180. /** Indicates that the phone auth credential was created with an empty verification code.
  181. */
  182. case missingVerificationCode = 17043
  183. /** Indicates that an invalid verification code was used in the verifyPhoneNumber request.
  184. */
  185. case invalidVerificationCode = 17044
  186. /** Indicates that the phone auth credential was created with an empty verification ID.
  187. */
  188. case missingVerificationID = 17045
  189. /** Indicates that an invalid verification ID was used in the verifyPhoneNumber request.
  190. */
  191. case invalidVerificationID = 17046
  192. /** Indicates that the APNS device token is missing in the verifyClient request.
  193. */
  194. case missingAppCredential = 17047
  195. /** Indicates that an invalid APNS device token was used in the verifyClient request.
  196. */
  197. case invalidAppCredential = 17048
  198. // The enum values between 17048 and 17051 are reserved and should NOT be used for new error
  199. // codes.
  200. /** Indicates that the SMS code has expired.
  201. */
  202. case sessionExpired = 17051
  203. /** Indicates that the quota of SMS messages for a given project has been exceeded.
  204. */
  205. case quotaExceeded = 17052
  206. /** Indicates that the APNs device token could not be obtained. The app may not have set up
  207. remote notification correctly or may fail to forward the APNs device token to FIRAuth
  208. if app delegate swizzling is disabled.
  209. */
  210. case missingAppToken = 17053
  211. /** Indicates that the app fails to forward remote notification to FIRAuth.
  212. */
  213. case notificationNotForwarded = 17054
  214. /** Indicates that the app could not be verified by Firebase during phone number authentication.
  215. */
  216. case appNotVerified = 17055
  217. /** Indicates that the reCAPTCHA token is not valid.
  218. */
  219. case captchaCheckFailed = 17056
  220. /** Indicates that an attempt was made to present a new web context while one was already being
  221. presented.
  222. */
  223. case webContextAlreadyPresented = 17057
  224. /** Indicates that the URL presentation was cancelled prematurely by the user.
  225. */
  226. case webContextCancelled = 17058
  227. /** Indicates a general failure during the app verification flow.
  228. */
  229. case appVerificationUserInteractionFailure = 17059
  230. /** Indicates that the clientID used to invoke a web flow is invalid.
  231. */
  232. case invalidClientID = 17060
  233. /** Indicates that a network request within a SFSafariViewController or WKWebView failed.
  234. */
  235. case webNetworkRequestFailed = 17061
  236. /** Indicates that an internal error occurred within a SFSafariViewController or WKWebView.
  237. */
  238. case webInternalError = 17062
  239. /** Indicates a general failure during a web sign-in flow.
  240. */
  241. case webSignInUserInteractionFailure = 17063
  242. /** Indicates that the local player was not authenticated prior to attempting Game Center
  243. signin.
  244. */
  245. case localPlayerNotAuthenticated = 17066
  246. /** Indicates that a non-null user was expected as an argmument to the operation but a null
  247. user was provided.
  248. */
  249. case nullUser = 17067
  250. /** Indicates that a Firebase Dynamic Link is not activated.
  251. */
  252. case dynamicLinkNotActivated = 17068
  253. /**
  254. * Represents the error code for when the given provider id for a web operation is invalid.
  255. */
  256. case invalidProviderID = 17071
  257. /**
  258. * Represents the error code for when an attempt is made to update the current user with a
  259. * tenantId that differs from the current FirebaseAuth instance's tenantId.
  260. */
  261. case tenantIDMismatch = 17072
  262. /**
  263. * Represents the error code for when a request is made to the backend with an associated tenant
  264. * ID for an operation that does not support multi-tenancy.
  265. */
  266. case unsupportedTenantOperation = 17073
  267. /** Indicates that the Firebase Dynamic Link domain used is either not configured or is
  268. unauthorized for the current project.
  269. */
  270. case invalidDynamicLinkDomain = 17074
  271. /** Indicates that the credential is rejected because it's misformed or mismatching.
  272. */
  273. case rejectedCredential = 17075
  274. /** Indicates that the GameKit framework is not linked prior to attempting Game Center signin.
  275. */
  276. case gameKitNotLinked = 17076
  277. /** Indicates that the second factor is required for signin.
  278. */
  279. case secondFactorRequired = 17078
  280. /** Indicates that the multi factor session is missing.
  281. */
  282. case missingMultiFactorSession = 17081
  283. /** Indicates that the multi factor info is missing.
  284. */
  285. case missingMultiFactorInfo = 17082
  286. /** Indicates that the multi factor session is invalid.
  287. */
  288. case invalidMultiFactorSession = 17083
  289. /** Indicates that the multi factor info is not found.
  290. */
  291. case multiFactorInfoNotFound = 17084
  292. /** Indicates that the operation is admin restricted.
  293. */
  294. case adminRestrictedOperation = 17085
  295. /** Indicates that the email is required for verification.
  296. */
  297. case unverifiedEmail = 17086
  298. /** Indicates that the second factor is already enrolled.
  299. */
  300. case secondFactorAlreadyEnrolled = 17087
  301. /** Indicates that the maximum second factor count is exceeded.
  302. */
  303. case maximumSecondFactorCountExceeded = 17088
  304. /** Indicates that the first factor is not supported.
  305. */
  306. case unsupportedFirstFactor = 17089
  307. /** Indicates that the a verifed email is required to changed to.
  308. */
  309. case emailChangeNeedsVerification = 17090
  310. /** Indicates that the nonce is missing or invalid.
  311. */
  312. case missingOrInvalidNonce = 17094
  313. /** Raised when n Cloud Function returns a blocking error. Will include a message returned from
  314. * the function.
  315. */
  316. case blockingCloudFunctionError = 17105
  317. /** Indicates an error for when the client identifier is missing.
  318. */
  319. case missingClientIdentifier = 17993
  320. /** Indicates an error occurred while attempting to access the keychain.
  321. */
  322. case keychainError = 17995
  323. /** Indicates an internal error occurred.
  324. */
  325. case internalError = 17999
  326. /** Raised when a JWT fails to parse correctly. May be accompanied by an underlying error
  327. describing which step of the JWT parsing process failed.
  328. */
  329. case malformedJWT = 18000
  330. var errorDescription: String {
  331. switch self {
  332. case .invalidCustomToken:
  333. return kFIRAuthErrorMessageInvalidCustomToken
  334. case .customTokenMismatch:
  335. return kFIRAuthErrorMessageCustomTokenMismatch
  336. case .invalidEmail:
  337. return kFIRAuthErrorMessageInvalidEmail
  338. case .invalidCredential:
  339. return kFIRAuthErrorMessageInvalidCredential
  340. case .userDisabled:
  341. return kFIRAuthErrorMessageUserDisabled
  342. case .emailAlreadyInUse:
  343. return kFIRAuthErrorMessageEmailAlreadyInUse
  344. case .wrongPassword:
  345. return kFIRAuthErrorMessageWrongPassword
  346. case .tooManyRequests:
  347. return kFIRAuthErrorMessageTooManyRequests
  348. case .accountExistsWithDifferentCredential:
  349. return kFIRAuthErrorMessageAccountExistsWithDifferentCredential
  350. case .requiresRecentLogin:
  351. return kFIRAuthErrorMessageRequiresRecentLogin
  352. case .providerAlreadyLinked:
  353. return kFIRAuthErrorMessageProviderAlreadyLinked
  354. case .noSuchProvider:
  355. return kFIRAuthErrorMessageNoSuchProvider
  356. case .invalidUserToken:
  357. return kFIRAuthErrorMessageInvalidUserToken
  358. case .networkError:
  359. return kFIRAuthErrorMessageNetworkError
  360. case .keychainError:
  361. return kFIRAuthErrorMessageKeychainError
  362. case .missingClientIdentifier:
  363. return kFIRAuthErrorMessageMissingClientIdentifier
  364. case .userTokenExpired:
  365. return kFIRAuthErrorMessageUserTokenExpired
  366. case .userNotFound:
  367. return kFIRAuthErrorMessageUserNotFound
  368. case .invalidAPIKey:
  369. return kFIRAuthErrorMessageInvalidAPIKey
  370. case .credentialAlreadyInUse:
  371. return kFIRAuthErrorMessageCredentialAlreadyInUse
  372. case .internalError:
  373. return kFIRAuthErrorMessageInternalError
  374. case .userMismatch:
  375. return FIRAuthErrorMessageUserMismatch
  376. case .operationNotAllowed:
  377. return kFIRAuthErrorMessageOperationNotAllowed
  378. case .weakPassword:
  379. return kFIRAuthErrorMessageWeakPassword
  380. case .appNotAuthorized:
  381. return kFIRAuthErrorMessageAppNotAuthorized
  382. case .expiredActionCode:
  383. return kFIRAuthErrorMessageExpiredActionCode
  384. case .invalidActionCode:
  385. return kFIRAuthErrorMessageInvalidActionCode
  386. case .invalidSender:
  387. return kFIRAuthErrorMessageInvalidSender
  388. case .invalidMessagePayload:
  389. return kFIRAuthErrorMessageInvalidMessagePayload
  390. case .invalidRecipientEmail:
  391. return kFIRAuthErrorMessageInvalidRecipientEmail
  392. case .missingIosBundleID:
  393. return kFIRAuthErrorMessageMissingIosBundleID
  394. case .missingAndroidPackageName:
  395. return kFIRAuthErrorMessageMissingAndroidPackageName
  396. case .unauthorizedDomain:
  397. return kFIRAuthErrorMessageUnauthorizedDomain
  398. case .invalidContinueURI:
  399. return kFIRAuthErrorMessageInvalidContinueURI
  400. case .missingContinueURI:
  401. return kFIRAuthErrorMessageMissingContinueURI
  402. case .missingEmail:
  403. return kFIRAuthErrorMessageMissingEmail
  404. case .missingPhoneNumber:
  405. return kFIRAuthErrorMessageMissingPhoneNumber
  406. case .invalidPhoneNumber:
  407. return kFIRAuthErrorMessageInvalidPhoneNumber
  408. case .missingVerificationCode:
  409. return kFIRAuthErrorMessageMissingVerificationCode
  410. case .invalidVerificationCode:
  411. return kFIRAuthErrorMessageInvalidVerificationCode
  412. case .missingVerificationID:
  413. return kFIRAuthErrorMessageMissingVerificationID
  414. case .invalidVerificationID:
  415. return kFIRAuthErrorMessageInvalidVerificationID
  416. case .sessionExpired:
  417. return kFIRAuthErrorMessageSessionExpired
  418. case .missingAppCredential:
  419. return kFIRAuthErrorMessageMissingAppCredential
  420. case .invalidAppCredential:
  421. return kFIRAuthErrorMessageInvalidAppCredential
  422. case .quotaExceeded:
  423. return kFIRAuthErrorMessageQuotaExceeded
  424. case .missingAppToken:
  425. return kFIRAuthErrorMessageMissingAppToken
  426. case .notificationNotForwarded:
  427. return kFIRAuthErrorMessageNotificationNotForwarded
  428. case .appNotVerified:
  429. return kFIRAuthErrorMessageAppNotVerified
  430. case .captchaCheckFailed:
  431. return kFIRAuthErrorMessageCaptchaCheckFailed
  432. case .webContextAlreadyPresented:
  433. return kFIRAuthErrorMessageWebContextAlreadyPresented
  434. case .webContextCancelled:
  435. return kFIRAuthErrorMessageWebContextCancelled
  436. case .invalidClientID:
  437. return kFIRAuthErrorMessageInvalidClientID
  438. case .appVerificationUserInteractionFailure:
  439. return kFIRAuthErrorMessageAppVerificationUserInteractionFailure
  440. case .webNetworkRequestFailed:
  441. return kFIRAuthErrorMessageWebRequestFailed
  442. case .nullUser:
  443. return kFIRAuthErrorMessageNullUser
  444. case .invalidProviderID:
  445. return kFIRAuthErrorMessageInvalidProviderID
  446. case .invalidDynamicLinkDomain:
  447. return kFIRAuthErrorMessageInvalidDynamicLinkDomain
  448. case .webInternalError:
  449. return kFIRAuthErrorMessageWebInternalError
  450. case .webSignInUserInteractionFailure:
  451. return kFIRAuthErrorMessageAppVerificationUserInteractionFailure
  452. case .malformedJWT:
  453. return kFIRAuthErrorMessageMalformedJWT
  454. case .localPlayerNotAuthenticated:
  455. return kFIRAuthErrorMessageLocalPlayerNotAuthenticated
  456. case .gameKitNotLinked:
  457. return kFIRAuthErrorMessageGameKitNotLinked
  458. case .secondFactorRequired:
  459. return kFIRAuthErrorMessageSecondFactorRequired
  460. case .missingMultiFactorSession:
  461. return FIRAuthErrorMessageMissingMultiFactorSession
  462. case .missingMultiFactorInfo:
  463. return FIRAuthErrorMessageMissingMultiFactorInfo
  464. case .invalidMultiFactorSession:
  465. return FIRAuthErrorMessageInvalidMultiFactorSession
  466. case .multiFactorInfoNotFound:
  467. return FIRAuthErrorMessageMultiFactorInfoNotFound
  468. case .adminRestrictedOperation:
  469. return FIRAuthErrorMessageAdminRestrictedOperation
  470. case .unverifiedEmail:
  471. return FIRAuthErrorMessageUnverifiedEmail
  472. case .secondFactorAlreadyEnrolled:
  473. return FIRAuthErrorMessageSecondFactorAlreadyEnrolled
  474. case .maximumSecondFactorCountExceeded:
  475. return FIRAuthErrorMessageMaximumSecondFactorCountExceeded
  476. case .unsupportedFirstFactor:
  477. return FIRAuthErrorMessageUnsupportedFirstFactor
  478. case .emailChangeNeedsVerification:
  479. return FIRAuthErrorMessageEmailChangeNeedsVerification
  480. case .dynamicLinkNotActivated:
  481. return kFIRAuthErrorMessageDynamicLinkNotActivated
  482. case .rejectedCredential:
  483. return kFIRAuthErrorMessageRejectedCredential
  484. case .missingOrInvalidNonce:
  485. return kFIRAuthErrorMessageMissingOrInvalidNonce
  486. case .tenantIDMismatch:
  487. return kFIRAuthErrorMessageTenantIDMismatch
  488. case .unsupportedTenantOperation:
  489. return kFIRAuthErrorMessageUnsupportedTenantOperation
  490. case .blockingCloudFunctionError:
  491. return kFIRAuthErrorMessageBlockingCloudFunctionReturnedError
  492. }
  493. }
  494. var errorCodeString: String {
  495. switch self {
  496. case .invalidCustomToken:
  497. return "ERROR_INVALID_CUSTOM_TOKEN"
  498. case .customTokenMismatch:
  499. return "ERROR_CUSTOM_TOKEN_MISMATCH"
  500. case .invalidEmail:
  501. return "ERROR_INVALID_EMAIL"
  502. case .invalidCredential:
  503. return "ERROR_INVALID_CREDENTIAL"
  504. case .userDisabled:
  505. return "ERROR_USER_DISABLED"
  506. case .emailAlreadyInUse:
  507. return "ERROR_EMAIL_ALREADY_IN_USE"
  508. case .wrongPassword:
  509. return "ERROR_WRONG_PASSWORD"
  510. case .tooManyRequests:
  511. return "ERROR_TOO_MANY_REQUESTS"
  512. case .accountExistsWithDifferentCredential:
  513. return "ERROR_ACCOUNT_EXISTS_WITH_DIFFERENT_CREDENTIAL"
  514. case .requiresRecentLogin:
  515. return "ERROR_REQUIRES_RECENT_LOGIN"
  516. case .providerAlreadyLinked:
  517. return "ERROR_PROVIDER_ALREADY_LINKED"
  518. case .noSuchProvider:
  519. return "ERROR_NO_SUCH_PROVIDER"
  520. case .invalidUserToken:
  521. return "ERROR_INVALID_USER_TOKEN"
  522. case .networkError:
  523. return "ERROR_NETWORK_REQUEST_FAILED"
  524. case .keychainError:
  525. return "ERROR_KEYCHAIN_ERROR"
  526. case .missingClientIdentifier:
  527. return "ERROR_MISSING_CLIENT_IDENTIFIER"
  528. case .userTokenExpired:
  529. return "ERROR_USER_TOKEN_EXPIRED"
  530. case .userNotFound:
  531. return "ERROR_USER_NOT_FOUND"
  532. case .invalidAPIKey:
  533. return "ERROR_INVALID_API_KEY"
  534. case .credentialAlreadyInUse:
  535. return "ERROR_CREDENTIAL_ALREADY_IN_USE"
  536. case .internalError:
  537. return "ERROR_INTERNAL_ERROR"
  538. case .userMismatch:
  539. return "ERROR_USER_MISMATCH"
  540. case .operationNotAllowed:
  541. return "ERROR_OPERATION_NOT_ALLOWED"
  542. case .weakPassword:
  543. return "ERROR_WEAK_PASSWORD"
  544. case .appNotAuthorized:
  545. return "ERROR_APP_NOT_AUTHORIZED"
  546. case .expiredActionCode:
  547. return "ERROR_EXPIRED_ACTION_CODE"
  548. case .invalidActionCode:
  549. return "ERROR_INVALID_ACTION_CODE"
  550. case .invalidMessagePayload:
  551. return "ERROR_INVALID_MESSAGE_PAYLOAD"
  552. case .invalidSender:
  553. return "ERROR_INVALID_SENDER"
  554. case .invalidRecipientEmail:
  555. return "ERROR_INVALID_RECIPIENT_EMAIL"
  556. case .missingIosBundleID:
  557. return "ERROR_MISSING_IOS_BUNDLE_ID"
  558. case .missingAndroidPackageName:
  559. return "ERROR_MISSING_ANDROID_PKG_NAME"
  560. case .unauthorizedDomain:
  561. return "ERROR_UNAUTHORIZED_DOMAIN"
  562. case .invalidContinueURI:
  563. return "ERROR_INVALID_CONTINUE_URI"
  564. case .missingContinueURI:
  565. return "ERROR_MISSING_CONTINUE_URI"
  566. case .missingEmail:
  567. return "ERROR_MISSING_EMAIL"
  568. case .missingPhoneNumber:
  569. return "ERROR_MISSING_PHONE_NUMBER"
  570. case .invalidPhoneNumber:
  571. return "ERROR_INVALID_PHONE_NUMBER"
  572. case .missingVerificationCode:
  573. return "ERROR_MISSING_VERIFICATION_CODE"
  574. case .invalidVerificationCode:
  575. return "ERROR_INVALID_VERIFICATION_CODE"
  576. case .missingVerificationID:
  577. return "ERROR_MISSING_VERIFICATION_ID"
  578. case .invalidVerificationID:
  579. return "ERROR_INVALID_VERIFICATION_ID"
  580. case .sessionExpired:
  581. return "ERROR_SESSION_EXPIRED"
  582. case .missingAppCredential:
  583. return "MISSING_APP_CREDENTIAL"
  584. case .invalidAppCredential:
  585. return "INVALID_APP_CREDENTIAL"
  586. case .quotaExceeded:
  587. return "ERROR_QUOTA_EXCEEDED"
  588. case .missingAppToken:
  589. return "ERROR_MISSING_APP_TOKEN"
  590. case .notificationNotForwarded:
  591. return "ERROR_NOTIFICATION_NOT_FORWARDED"
  592. case .appNotVerified:
  593. return "ERROR_APP_NOT_VERIFIED"
  594. case .captchaCheckFailed:
  595. return "ERROR_CAPTCHA_CHECK_FAILED"
  596. case .webContextAlreadyPresented:
  597. return "ERROR_WEB_CONTEXT_ALREADY_PRESENTED"
  598. case .webContextCancelled:
  599. return "ERROR_WEB_CONTEXT_CANCELLED"
  600. case .invalidClientID:
  601. return "ERROR_INVALID_CLIENT_ID"
  602. case .appVerificationUserInteractionFailure:
  603. return "ERROR_APP_VERIFICATION_FAILED"
  604. case .webNetworkRequestFailed:
  605. return "ERROR_WEB_NETWORK_REQUEST_FAILED"
  606. case .nullUser:
  607. return "ERROR_NULL_USER"
  608. case .invalidProviderID:
  609. return "ERROR_INVALID_PROVIDER_ID"
  610. case .invalidDynamicLinkDomain:
  611. return "ERROR_INVALID_DYNAMIC_LINK_DOMAIN"
  612. case .webInternalError:
  613. return "ERROR_WEB_INTERNAL_ERROR"
  614. case .webSignInUserInteractionFailure:
  615. return "ERROR_WEB_USER_INTERACTION_FAILURE"
  616. case .malformedJWT:
  617. return "ERROR_MALFORMED_JWT"
  618. case .localPlayerNotAuthenticated:
  619. return "ERROR_LOCAL_PLAYER_NOT_AUTHENTICATED"
  620. case .gameKitNotLinked:
  621. return "ERROR_GAME_KIT_NOT_LINKED"
  622. case .secondFactorRequired:
  623. return "ERROR_SECOND_FACTOR_REQUIRED"
  624. case .missingMultiFactorSession:
  625. return "ERROR_MISSING_MULTI_FACTOR_SESSION"
  626. case .missingMultiFactorInfo:
  627. return "ERROR_MISSING_MULTI_FACTOR_INFO"
  628. case .invalidMultiFactorSession:
  629. return "ERROR_INVALID_MULTI_FACTOR_SESSION"
  630. case .multiFactorInfoNotFound:
  631. return "ERROR_MULTI_FACTOR_INFO_NOT_FOUND"
  632. case .adminRestrictedOperation:
  633. return "ERROR_ADMIN_RESTRICTED_OPERATION"
  634. case .unverifiedEmail:
  635. return "ERROR_UNVERIFIED_EMAIL"
  636. case .secondFactorAlreadyEnrolled:
  637. return "ERROR_SECOND_FACTOR_ALREADY_ENROLLED"
  638. case .maximumSecondFactorCountExceeded:
  639. return "ERROR_MAXIMUM_SECOND_FACTOR_COUNT_EXCEEDED"
  640. case .unsupportedFirstFactor:
  641. return "ERROR_UNSUPPORTED_FIRST_FACTOR"
  642. case .emailChangeNeedsVerification:
  643. return "ERROR_EMAIL_CHANGE_NEEDS_VERIFICATION"
  644. case .dynamicLinkNotActivated:
  645. return "ERROR_DYNAMIC_LINK_NOT_ACTIVATED"
  646. case .rejectedCredential:
  647. return "ERROR_REJECTED_CREDENTIAL"
  648. case .missingOrInvalidNonce:
  649. return "ERROR_MISSING_OR_INVALID_NONCE"
  650. case .tenantIDMismatch:
  651. return "ERROR_TENANT_ID_MISMATCH"
  652. case .unsupportedTenantOperation:
  653. return "ERROR_UNSUPPORTED_TENANT_OPERATION"
  654. case .blockingCloudFunctionError:
  655. return "ERROR_BLOCKING_CLOUD_FUNCTION_RETURNED_ERROR"
  656. }
  657. }
  658. }
  659. // MARK: - Standard Error Messages
  660. /** @var kFIRAuthErrorMessageInvalidCustomToken
  661. @brief Message for @c FIRAuthErrorCodeInvalidCustomToken error code.
  662. */
  663. private let kFIRAuthErrorMessageInvalidCustomToken =
  664. "The custom token format is incorrect. Please check the documentation."
  665. /** @var kFIRAuthErrorMessageCustomTokenMismatch
  666. @brief Message for @c FIRAuthErrorCodeCustomTokenMismatch error code.
  667. */
  668. private let kFIRAuthErrorMessageCustomTokenMismatch =
  669. "The custom token corresponds to a different audience."
  670. /** @var kFIRAuthErrorMessageInvalidEmail
  671. @brief Message for @c FIRAuthErrorCodeInvalidEmail error code.
  672. */
  673. private let kFIRAuthErrorMessageInvalidEmail = "The email address is badly formatted."
  674. /** @var kFIRAuthErrorMessageInvalidCredential
  675. @brief Message for @c FIRAuthErrorCodeInvalidCredential error code.
  676. */
  677. private let kFIRAuthErrorMessageInvalidCredential =
  678. "The supplied auth credential is malformed or has expired."
  679. /** @var kFIRAuthErrorMessageUserDisabled
  680. @brief Message for @c FIRAuthErrorCodeUserDisabled error code.
  681. */
  682. private let kFIRAuthErrorMessageUserDisabled =
  683. "The user account has been disabled by an administrator."
  684. /** @var kFIRAuthErrorMessageEmailAlreadyInUse
  685. @brief Message for @c FIRAuthErrorCodeEmailAlreadyInUse error code.
  686. */
  687. private let kFIRAuthErrorMessageEmailAlreadyInUse =
  688. "The email address is already in use by another account."
  689. /** @var kFIRAuthErrorMessageWrongPassword
  690. @brief Message for @c FIRAuthErrorCodeWrongPassword error code.
  691. */
  692. private let kFIRAuthErrorMessageWrongPassword =
  693. "The password is invalid or the user does not have a password."
  694. /** @var kFIRAuthErrorMessageTooManyRequests
  695. @brief Message for @c FIRAuthErrorCodeTooManyRequests error code.
  696. */
  697. private let kFIRAuthErrorMessageTooManyRequests =
  698. "We have blocked all requests from this device due to unusual activity. Try again later."
  699. /** @var kFIRAuthErrorMessageAccountExistsWithDifferentCredential
  700. @brief Message for @c FIRAuthErrorCodeAccountExistsWithDifferentCredential error code.
  701. */
  702. private let kFIRAuthErrorMessageAccountExistsWithDifferentCredential =
  703. "An account already exists with the same email address but different sign-in credentials. Sign in using a provider associated with this email address."
  704. /** @var kFIRAuthErrorMessageRequiresRecentLogin
  705. @brief Message for @c FIRAuthErrorCodeRequiresRecentLogin error code.
  706. */
  707. private let kFIRAuthErrorMessageRequiresRecentLogin =
  708. "This operation is sensitive and requires recent authentication. Log in again before retrying this request."
  709. /** @var kFIRAuthErrorMessageProviderAlreadyLinked
  710. @brief Message for @c FIRAuthErrorCodeProviderAlreadyExists error code.
  711. */
  712. private let kFIRAuthErrorMessageProviderAlreadyLinked =
  713. "[ERROR_PROVIDER_ALREADY_LINKED] - User can only be linked to one identity for the given provider."
  714. /** @var kFIRAuthErrorMessageNoSuchProvider
  715. @brief Message for @c FIRAuthErrorCodeNoSuchProvider error code.
  716. */
  717. private let kFIRAuthErrorMessageNoSuchProvider =
  718. "User was not linked to an account with the given provider."
  719. /** @var kFIRAuthErrorMessageInvalidUserToken
  720. @brief Message for @c FIRAuthErrorCodeInvalidUserToken error code.
  721. */
  722. private let kFIRAuthErrorMessageInvalidUserToken =
  723. "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."
  724. /** @var kFIRAuthErrorMessageNetworkError
  725. @brief Message for @c FIRAuthErrorCodeNetworkError error code.
  726. */
  727. private let kFIRAuthErrorMessageNetworkError =
  728. "Network error (such as timeout, interrupted connection or unreachable host) has occurred."
  729. /** @var kFIRAuthErrorMessageKeychainError
  730. @brief Message for @c FIRAuthErrorCodeKeychainError error code.
  731. */
  732. private let kFIRAuthErrorMessageKeychainError =
  733. "An error occurred when accessing the keychain. The NSLocalizedFailureReasonErrorKey field in the NSError.userInfo dictionary will contain more information about the error encountered"
  734. /** @var kFIRAuthErrorMessageMissingClientIdentifier
  735. @brief Message for @c FIRAuthErrorCodeMissingClientIdentifier error code.
  736. */
  737. private let kFIRAuthErrorMessageMissingClientIdentifier =
  738. "The request does not contain any client identifier."
  739. /** @var kFIRAuthErrorMessageUserTokenExpired
  740. @brief Message for @c FIRAuthErrorCodeTokenExpired error code.
  741. */
  742. private let kFIRAuthErrorMessageUserTokenExpired =
  743. "The user's credential is no longer valid. The user must sign in again."
  744. /** @var kFIRAuthErrorMessageUserNotFound
  745. @brief Message for @c FIRAuthErrorCodeUserNotFound error code.
  746. */
  747. private let kFIRAuthErrorMessageUserNotFound =
  748. "There is no user record corresponding to this identifier. The user may have been deleted."
  749. /** @var kFIRAuthErrorMessageInvalidAPIKey
  750. @brief Message for @c FIRAuthErrorCodeInvalidAPIKey error code.
  751. @remarks This error is not thrown by the server.
  752. */
  753. private let kFIRAuthErrorMessageInvalidAPIKey = "An invalid API Key was supplied in the request."
  754. /** @var kFIRAuthErrorMessageUserMismatch.
  755. @brief Message for @c FIRAuthErrorCodeInvalidAPIKey error code.
  756. */
  757. private let FIRAuthErrorMessageUserMismatch =
  758. "The supplied credentials do not correspond to the previously signed in user."
  759. /** @var kFIRAuthErrorMessageCredentialAlreadyInUse
  760. @brief Message for @c FIRAuthErrorCodeCredentialAlreadyInUse error code.
  761. */
  762. private let kFIRAuthErrorMessageCredentialAlreadyInUse =
  763. "This credential is already associated with a different user account."
  764. /** @var kFIRAuthErrorMessageOperationNotAllowed
  765. @brief Message for @c FIRAuthErrorCodeOperationNotAllowed error code.
  766. */
  767. private let kFIRAuthErrorMessageOperationNotAllowed =
  768. "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."
  769. /** @var kFIRAuthErrorMessageWeakPassword
  770. @brief Message for @c FIRAuthErrorCodeWeakPassword error code.
  771. */
  772. private let kFIRAuthErrorMessageWeakPassword = "The password must be 6 characters long or more."
  773. /** @var kFIRAuthErrorMessageAppNotAuthorized
  774. @brief Message for @c FIRAuthErrorCodeAppNotAuthorized error code.
  775. */
  776. private let kFIRAuthErrorMessageAppNotAuthorized =
  777. "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."
  778. /** @var kFIRAuthErrorMessageExpiredActionCode
  779. @brief Message for @c FIRAuthErrorCodeExpiredActionCode error code.
  780. */
  781. private let kFIRAuthErrorMessageExpiredActionCode = "The action code has expired."
  782. /** @var kFIRAuthErrorMessageInvalidActionCode
  783. @brief Message for @c FIRAuthErrorCodeInvalidActionCode error code.
  784. */
  785. private let kFIRAuthErrorMessageInvalidActionCode =
  786. "The action code is invalid. This can happen if the code is malformed, expired, or has already been used."
  787. /** @var kFIRAuthErrorMessageInvalidMessagePayload
  788. @brief Message for @c FIRAuthErrorCodeInvalidMessagePayload error code.
  789. */
  790. private let kFIRAuthErrorMessageInvalidMessagePayload =
  791. "The action code is invalid. This can happen if the code is malformed, expired, or has already been used."
  792. /** @var kFIRAuthErrorMessageInvalidSender
  793. @brief Message for @c FIRAuthErrorCodeInvalidSender error code.
  794. */
  795. private let kFIRAuthErrorMessageInvalidSender =
  796. "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."
  797. /** @var kFIRAuthErrorMessageInvalidRecipientEmail
  798. @brief Message for @c FIRAuthErrorCodeInvalidRecipient error code.
  799. */
  800. private let kFIRAuthErrorMessageInvalidRecipientEmail =
  801. "The action code is invalid. This can happen if the code is malformed, expired, or has already been used."
  802. /** @var kFIRAuthErrorMessageMissingIosBundleID
  803. @brief Message for @c FIRAuthErrorCodeMissingIosbundleID error code.
  804. */
  805. private let kFIRAuthErrorMessageMissingIosBundleID =
  806. "An iOS Bundle ID must be provided if an App Store ID is provided."
  807. /** @var kFIRAuthErrorMessageMissingAndroidPackageName
  808. @brief Message for @c FIRAuthErrorCodeMissingAndroidPackageName error code.
  809. */
  810. private let kFIRAuthErrorMessageMissingAndroidPackageName =
  811. "An Android Package Name must be provided if the Android App is required to be installed."
  812. /** @var kFIRAuthErrorMessageUnauthorizedDomain
  813. @brief Message for @c FIRAuthErrorCodeUnauthorizedDomain error code.
  814. */
  815. private let kFIRAuthErrorMessageUnauthorizedDomain =
  816. "The domain of the continue URL is not allowlisted. Please allowlist the domain in the Firebase console."
  817. /** @var kFIRAuthErrorMessageInvalidContinueURI
  818. @brief Message for @c FIRAuthErrorCodeInvalidContinueURI error code.
  819. */
  820. private let kFIRAuthErrorMessageInvalidContinueURI =
  821. "The continue URL provided in the request is invalid."
  822. /** @var kFIRAuthErrorMessageMissingEmail
  823. @brief Message for @c FIRAuthErrorCodeMissingEmail error code.
  824. */
  825. private let kFIRAuthErrorMessageMissingEmail = "An email address must be provided."
  826. /** @var kFIRAuthErrorMessageMissingContinueURI
  827. @brief Message for @c FIRAuthErrorCodeMissingContinueURI error code.
  828. */
  829. private let kFIRAuthErrorMessageMissingContinueURI =
  830. "A continue URL must be provided in the request."
  831. /** @var kFIRAuthErrorMessageMissingPhoneNumber
  832. @brief Message for @c FIRAuthErrorCodeMissingPhoneNumber error code.
  833. */
  834. private let kFIRAuthErrorMessageMissingPhoneNumber =
  835. "To send verification codes, provide a phone number for the recipient."
  836. /** @var kFIRAuthErrorMessageInvalidPhoneNumber
  837. @brief Message for @c FIRAuthErrorCodeInvalidPhoneNumber error code.
  838. */
  839. private let kFIRAuthErrorMessageInvalidPhoneNumber =
  840. "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]."
  841. /** @var kFIRAuthErrorMessageMissingVerificationCode
  842. @brief Message for @c FIRAuthErrorCodeMissingVerificationCode error code.
  843. */
  844. private let kFIRAuthErrorMessageMissingVerificationCode =
  845. "The phone auth credential was created with an empty SMS verification Code."
  846. /** @var kFIRAuthErrorMessageInvalidVerificationCode
  847. @brief Message for @c FIRAuthErrorCodeInvalidVerificationCode error code.
  848. */
  849. private let kFIRAuthErrorMessageInvalidVerificationCode =
  850. "The SMS verification code used to create the phone auth credential is invalid. Please resend the verification code SMS and be sure to use the verification code provided by the user."
  851. /** @var kFIRAuthErrorMessageMissingVerificationID
  852. @brief Message for @c FIRAuthErrorCodeInvalidVerificationID error code.
  853. */
  854. private let kFIRAuthErrorMessageMissingVerificationID =
  855. "The phone auth credential was created with an empty verification ID."
  856. /** @var kFIRAuthErrorMessageInvalidVerificationID
  857. @brief Message for @c FIRAuthErrorCodeInvalidVerificationID error code.
  858. */
  859. private let kFIRAuthErrorMessageInvalidVerificationID =
  860. "The verification ID used to create the phone auth credential is invalid."
  861. /** @var kFIRAuthErrorMessageLocalPlayerNotAuthenticated
  862. @brief Message for @c FIRAuthErrorCodeLocalPlayerNotAuthenticated error code.
  863. */
  864. private let kFIRAuthErrorMessageLocalPlayerNotAuthenticated =
  865. "The local player is not authenticated. Please log the local player in to Game Center."
  866. /** @var kFIRAuthErrorMessageGameKitNotLinked
  867. @brief Message for @c kFIRAuthErrorMessageGameKitNotLinked error code.
  868. */
  869. private let kFIRAuthErrorMessageGameKitNotLinked =
  870. "The GameKit framework is not linked. Please turn on the Game Center capability."
  871. /** @var kFIRAuthErrorMessageSessionExpired
  872. @brief Message for @c FIRAuthErrorCodeSessionExpired error code.
  873. */
  874. private let kFIRAuthErrorMessageSessionExpired =
  875. "The SMS code has expired. Please re-send the verification code to try again."
  876. /** @var kFIRAuthErrorMessageMissingAppCredential
  877. @brief Message for @c FIRAuthErrorCodeMissingAppCredential error code.
  878. */
  879. private let kFIRAuthErrorMessageMissingAppCredential =
  880. "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."
  881. /** @var kFIRAuthErrorMessageInvalidAppCredential
  882. @brief Message for @c FIRAuthErrorCodeInvalidAppCredential error code.
  883. */
  884. private let kFIRAuthErrorMessageInvalidAppCredential =
  885. "The APNs device token provided is either incorrect or does not match the private certificate uploaded to the Firebase Console."
  886. /** @var kFIRAuthErrorMessageQuotaExceeded
  887. @brief Message for @c FIRAuthErrorCodeQuotaExceeded error code.
  888. */
  889. private let kFIRAuthErrorMessageQuotaExceeded = "The quota for this operation has been exceeded."
  890. /** @var kFIRAuthErrorMessageMissingAppToken
  891. @brief Message for @c FIRAuthErrorCodeMissingAppToken error code.
  892. */
  893. private let kFIRAuthErrorMessageMissingAppToken =
  894. "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"
  895. /** @var kFIRAuthErrorMessageMissingAppToken
  896. @brief Message for @c FIRAuthErrorCodeMissingAppToken error code.
  897. */
  898. private let kFIRAuthErrorMessageNotificationNotForwarded =
  899. "If app delegate swizzling is disabled, remote notifications received by UIApplicationDelegate need to be forwarded to FIRAuth's canHandleNotificaton: method."
  900. /** @var kFIRAuthErrorMessageAppNotVerified
  901. @brief Message for @c FIRAuthErrorCodeMissingAppToken error code.
  902. */
  903. private let kFIRAuthErrorMessageAppNotVerified =
  904. "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."
  905. /** @var kFIRAuthErrorMessageCaptchaCheckFailed
  906. @brief Message for @c FIRAuthErrorCodeCaptchaCheckFailed error code.
  907. */
  908. private let kFIRAuthErrorMessageCaptchaCheckFailed =
  909. "The reCAPTCHA response token provided is either invalid, expired or already"
  910. /** @var kFIRAuthErrorMessageWebContextAlreadyPresented
  911. @brief Message for @c FIRAuthErrorCodeWebContextAlreadyPresented error code.
  912. */
  913. private let kFIRAuthErrorMessageWebContextAlreadyPresented =
  914. "User interaction is still ongoing, another view cannot be presented."
  915. /** @var kFIRAuthErrorMessageWebContextCancelled
  916. @brief Message for @c FIRAuthErrorCodeWebContextCancelled error code.
  917. */
  918. private let kFIRAuthErrorMessageWebContextCancelled = "The interaction was cancelled by the user."
  919. /** @var kFIRAuthErrorMessageInvalidClientID
  920. @brief Message for @c FIRAuthErrorCodeInvalidClientID error code.
  921. */
  922. private let kFIRAuthErrorMessageInvalidClientID =
  923. "The OAuth client ID provided is either invalid or does not match the specified API key."
  924. /** @var kFIRAuthErrorMessageWebRequestFailed
  925. @brief Message for @c FIRAuthErrorCodeWebRequestFailed error code.
  926. */
  927. private let kFIRAuthErrorMessageWebRequestFailed =
  928. "A network error (such as timeout, interrupted connection, or unreachable host) has occurred within the web context."
  929. /** @var kFIRAuthErrorMessageWebInternalError
  930. @brief Message for @c FIRAuthErrorCodeWebInternalError error code.
  931. */
  932. private let kFIRAuthErrorMessageWebInternalError =
  933. "An internal error has occurred within the SFSafariViewController or WKWebView."
  934. /** @var kFIRAuthErrorMessageAppVerificationUserInteractionFailure
  935. @brief Message for @c FIRAuthErrorCodeInvalidClientID error code.
  936. */
  937. private let kFIRAuthErrorMessageAppVerificationUserInteractionFailure =
  938. "The app verification process has failed, print and inspect the error details for more information"
  939. /** @var kFIRAuthErrorMessageNullUser
  940. @brief Message for @c FIRAuthErrorCodeNullUser error code.
  941. */
  942. private let kFIRAuthErrorMessageNullUser =
  943. "A null user object was provided as the argument for an operation which requires a non-null user object."
  944. /** @var kFIRAuthErrorMessageInvalidProviderID
  945. @brief Message for @c FIRAuthErrorCodeInvalidProviderID error code.
  946. */
  947. private let kFIRAuthErrorMessageInvalidProviderID =
  948. "The provider ID provided for the attempted web operation is invalid."
  949. /** @var kFIRAuthErrorMessageInvalidDynamicLinkDomain
  950. @brief Message for @c kFIRAuthErrorMessageInvalidDynamicLinkDomain error code.
  951. */
  952. private let kFIRAuthErrorMessageInvalidDynamicLinkDomain =
  953. "The Firebase Dynamic Link domain used is either not configured or is unauthorized for the current project."
  954. /** @var kFIRAuthErrorMessageInternalError
  955. @brief Message for @c FIRAuthErrorCodeInternalError error code.
  956. */
  957. private let kFIRAuthErrorMessageInternalError =
  958. "An internal error has occurred, print and inspect the error details for more information."
  959. /** @var kFIRAuthErrorMessageMalformedJWT
  960. @brief Error message constant describing @c FIRAuthErrorCodeMalformedJWT errors.
  961. */
  962. private let kFIRAuthErrorMessageMalformedJWT =
  963. "Failed to parse JWT. Check the userInfo dictionary for the full token."
  964. /** @var kFIRAuthErrorMessageSecondFactorRequired
  965. @brief Message for @c kFIRAuthErrorMessageSecondFactorRequired error code.
  966. */
  967. private let kFIRAuthErrorMessageSecondFactorRequired =
  968. "Please complete a second factor challenge to finish signing into this account."
  969. /** @var kFIRAuthErrorMessageSecondFactorRequired
  970. @brief Message for @c kFIRAuthErrorMessageSecondFactorRequired error code.
  971. */
  972. private let FIRAuthErrorMessageMissingMultiFactorSession =
  973. "The request is missing proof of first factor successful sign-in."
  974. /** @var kFIRAuthErrorMessageSecondFactorRequired
  975. @brief Message for @c kFIRAuthErrorMessageSecondFactorRequired error code.
  976. */
  977. private let FIRAuthErrorMessageMissingMultiFactorInfo =
  978. "No second factor identifier is provided."
  979. /** @var kFIRAuthErrorMessageSecondFactorRequired
  980. @brief Message for @c kFIRAuthErrorMessageSecondFactorRequired error code.
  981. */
  982. private let FIRAuthErrorMessageInvalidMultiFactorSession =
  983. "The request does not contain a valid proof of first factor successful sign-in."
  984. /** @var kFIRAuthErrorMessageSecondFactorRequired
  985. @brief Message for @c kFIRAuthErrorMessageSecondFactorRequired error code.
  986. */
  987. private let FIRAuthErrorMessageMultiFactorInfoNotFound =
  988. "The user does not have a second factor matching the identifier provided."
  989. /** @var kFIRAuthErrorMessageSecondFactorRequired
  990. @brief Message for @c kFIRAuthErrorMessageSecondFactorRequired error code.
  991. */
  992. private let FIRAuthErrorMessageAdminRestrictedOperation =
  993. "This operation is restricted to administrators only."
  994. /** @var kFIRAuthErrorMessageSecondFactorRequired
  995. @brief Message for @c kFIRAuthErrorMessageSecondFactorRequired error code.
  996. */
  997. private let FIRAuthErrorMessageUnverifiedEmail =
  998. "The operation requires a verified email."
  999. /** @var kFIRAuthErrorMessageSecondFactorRequired
  1000. @brief Message for @c kFIRAuthErrorMessageSecondFactorRequired error code.
  1001. */
  1002. private let FIRAuthErrorMessageSecondFactorAlreadyEnrolled =
  1003. "The second factor is already enrolled on this account."
  1004. /** @var kFIRAuthErrorMessageSecondFactorRequired
  1005. @brief Message for @c kFIRAuthErrorMessageSecondFactorRequired error code.
  1006. */
  1007. private let FIRAuthErrorMessageMaximumSecondFactorCountExceeded =
  1008. "The maximum allowed number of second factors on a user has been exceeded."
  1009. /** @var kFIRAuthErrorMessageSecondFactorRequired
  1010. @brief Message for @c kFIRAuthErrorMessageSecondFactorRequired error code.
  1011. */
  1012. private let FIRAuthErrorMessageUnsupportedFirstFactor =
  1013. "Enrolling a second factor or signing in with a multi-factor account requires sign-in with a supported first factor."
  1014. /** @var kFIRAuthErrorMessageSecondFactorRequired
  1015. @brief Message for @c kFIRAuthErrorMessageSecondFactorRequired error code.
  1016. */
  1017. private let FIRAuthErrorMessageEmailChangeNeedsVerification =
  1018. "Multi-factor users must always have a verified email."
  1019. /** @var kFIRAuthErrorMessageDynamicLinkNotActivated
  1020. @brief Error message constant describing @c FIRAuthErrorCodeDynamicLinkNotActivated errors.
  1021. */
  1022. private let kFIRAuthErrorMessageDynamicLinkNotActivated =
  1023. "Please activate Dynamic Links in the Firebase Console and agree to the terms and conditions."
  1024. /** @var kFIRAuthErrorMessageRejectedCredential
  1025. @brief Error message constant describing @c FIRAuthErrorCodeRejectedCredential errors.
  1026. */
  1027. private let kFIRAuthErrorMessageRejectedCredential =
  1028. "The request contains malformed or mismatching credentials."
  1029. /** @var kFIRAuthErrorMessageMissingOrInvalidNonce
  1030. @brief Error message constant describing @c FIRAuthErrorCodeMissingOrInvalidNonce errors.
  1031. */
  1032. private let kFIRAuthErrorMessageMissingOrInvalidNonce =
  1033. "The request contains malformed or mismatched credentials."
  1034. /** @var kFIRAuthErrorMessageTenantIDMismatch.
  1035. @brief Message for @c FIRAuthErrorCodeTenantIDMismatch error code.
  1036. */
  1037. private let kFIRAuthErrorMessageTenantIDMismatch =
  1038. "The provided user's tenant ID does not match the Auth instance's tenant ID."
  1039. /** @var kFIRAuthErrorMessageUnsupportedTenantOperation
  1040. @brief Message for @c FIRAuthErrorCodeUnsupportedTenantOperation error code.
  1041. */
  1042. private let kFIRAuthErrorMessageUnsupportedTenantOperation =
  1043. "This operation is not supported in a multi-tenant context."
  1044. /** @var kFIRAuthErrorMessageBlockingCloudFunctionReturnedError
  1045. @brief Message for @c FIRAuthErrorCodeBlockingCloudFunctionError error code.
  1046. */
  1047. private let kFIRAuthErrorMessageBlockingCloudFunctionReturnedError =
  1048. "Blocking cloud function returned an error."