AuthErrors.swift 50 KB

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