No Description

FIRAuthErrors.h 12KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366
  1. /*
  2. * Copyright 2017 Google
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. #import <Foundation/Foundation.h>
  17. NS_ASSUME_NONNULL_BEGIN
  18. /** @class FIRAuthErrors
  19. @remarks Error Codes common to all API Methods:
  20. + `FIRAuthErrorCodeNetworkError`
  21. + `FIRAuthErrorCodeUserNotFound`
  22. + `FIRAuthErrorCodeUserTokenExpired`
  23. + `FIRAuthErrorCodeTooManyRequests`
  24. + `FIRAuthErrorCodeInvalidAPIKey`
  25. + `FIRAuthErrorCodeAppNotAuthorized`
  26. + `FIRAuthErrorCodeKeychainError`
  27. + `FIRAuthErrorCodeInternalError`
  28. @remarks Common error codes for `FIRUser` operations:
  29. + `FIRAuthErrorCodeInvalidUserToken`
  30. + `FIRAuthErrorCodeUserDisabled`
  31. */
  32. NS_SWIFT_NAME(AuthErrors)
  33. @interface FIRAuthErrors
  34. /**
  35. @brief The Firebase Auth error domain.
  36. */
  37. extern NSString *const FIRAuthErrorDomain NS_SWIFT_NAME(AuthErrorDomain);
  38. /**
  39. @brief The name of the key for the error short string of an error code.
  40. */
  41. extern NSString *const FIRAuthErrorUserInfoNameKey NS_SWIFT_NAME(AuthErrorUserInfoNameKey);
  42. /**
  43. @brief Errors with one of the following three codes:
  44. - `FIRAuthErrorCodeAccountExistsWithDifferentCredential`
  45. - `FIRAuthErrorCodeCredentialAlreadyInUse`
  46. - `FIRAuthErrorCodeEmailAlreadyInUse`
  47. may contain an `NSError.userInfo` dictinary object which contains this key. The value
  48. associated with this key is an NSString of the email address of the account that already
  49. exists.
  50. */
  51. extern NSString *const FIRAuthErrorUserInfoEmailKey NS_SWIFT_NAME(AuthErrorUserInfoEmailKey);
  52. /**
  53. @brief The key used to read the updated Auth credential from the userInfo dictionary of the
  54. NSError object returned. This is the updated auth credential the developer should use for
  55. recovery if applicable.
  56. */
  57. extern NSString *const FIRAuthErrorUserInfoUpdatedCredentialKey
  58. NS_SWIFT_NAME(AuthErrorUserInfoUpdatedCredentialKey);
  59. /**
  60. @brief Error codes used by Firebase Auth.
  61. */
  62. typedef NS_ENUM(NSInteger, FIRAuthErrorCode) {
  63. /** Indicates a validation error with the custom token.
  64. */
  65. FIRAuthErrorCodeInvalidCustomToken = 17000,
  66. /** Indicates the service account and the API key belong to different projects.
  67. */
  68. FIRAuthErrorCodeCustomTokenMismatch = 17002,
  69. /** Indicates the IDP token or requestUri is invalid.
  70. */
  71. FIRAuthErrorCodeInvalidCredential = 17004,
  72. /** Indicates the user's account is disabled on the server.
  73. */
  74. FIRAuthErrorCodeUserDisabled = 17005,
  75. /** Indicates the administrator disabled sign in with the specified identity provider.
  76. */
  77. FIRAuthErrorCodeOperationNotAllowed = 17006,
  78. /** Indicates the email used to attempt a sign up is already in use.
  79. */
  80. FIRAuthErrorCodeEmailAlreadyInUse = 17007,
  81. /** Indicates the email is invalid.
  82. */
  83. FIRAuthErrorCodeInvalidEmail = 17008,
  84. /** Indicates the user attempted sign in with a wrong password.
  85. */
  86. FIRAuthErrorCodeWrongPassword = 17009,
  87. /** Indicates that too many requests were made to a server method.
  88. */
  89. FIRAuthErrorCodeTooManyRequests = 17010,
  90. /** Indicates the user account was not found.
  91. */
  92. FIRAuthErrorCodeUserNotFound = 17011,
  93. /** Indicates account linking is required.
  94. */
  95. FIRAuthErrorCodeAccountExistsWithDifferentCredential = 17012,
  96. /** Indicates the user has attemped to change email or password more than 5 minutes after
  97. signing in.
  98. */
  99. FIRAuthErrorCodeRequiresRecentLogin = 17014,
  100. /** Indicates an attempt to link a provider to which the account is already linked.
  101. */
  102. FIRAuthErrorCodeProviderAlreadyLinked = 17015,
  103. /** Indicates an attempt to unlink a provider that is not linked.
  104. */
  105. FIRAuthErrorCodeNoSuchProvider = 17016,
  106. /** Indicates user's saved auth credential is invalid, the user needs to sign in again.
  107. */
  108. FIRAuthErrorCodeInvalidUserToken = 17017,
  109. /** Indicates a network error occurred (such as a timeout, interrupted connection, or
  110. unreachable host). These types of errors are often recoverable with a retry. The
  111. `NSUnderlyingError` field in the `NSError.userInfo` dictionary will contain the error
  112. encountered.
  113. */
  114. FIRAuthErrorCodeNetworkError = 17020,
  115. /** Indicates the saved token has expired, for example, the user may have changed account
  116. password on another device. The user needs to sign in again on the device that made this
  117. request.
  118. */
  119. FIRAuthErrorCodeUserTokenExpired = 17021,
  120. /** Indicates an invalid API key was supplied in the request.
  121. */
  122. FIRAuthErrorCodeInvalidAPIKey = 17023,
  123. /** Indicates that an attempt was made to reauthenticate with a user which is not the current
  124. user.
  125. */
  126. FIRAuthErrorCodeUserMismatch = 17024,
  127. /** Indicates an attempt to link with a credential that has already been linked with a
  128. different Firebase account
  129. */
  130. FIRAuthErrorCodeCredentialAlreadyInUse = 17025,
  131. /** Indicates an attempt to set a password that is considered too weak.
  132. */
  133. FIRAuthErrorCodeWeakPassword = 17026,
  134. /** Indicates the App is not authorized to use Firebase Authentication with the
  135. provided API Key.
  136. */
  137. FIRAuthErrorCodeAppNotAuthorized = 17028,
  138. /** Indicates the OOB code is expired.
  139. */
  140. FIRAuthErrorCodeExpiredActionCode = 17029,
  141. /** Indicates the OOB code is invalid.
  142. */
  143. FIRAuthErrorCodeInvalidActionCode = 17030,
  144. /** Indicates that there are invalid parameters in the payload during a "send password reset
  145. * email" attempt.
  146. */
  147. FIRAuthErrorCodeInvalidMessagePayload = 17031,
  148. /** Indicates that the sender email is invalid during a "send password reset email" attempt.
  149. */
  150. FIRAuthErrorCodeInvalidSender = 17032,
  151. /** Indicates that the recipient email is invalid.
  152. */
  153. FIRAuthErrorCodeInvalidRecipientEmail = 17033,
  154. /** Indicates that an email address was expected but one was not provided.
  155. */
  156. FIRAuthErrorCodeMissingEmail = 17034,
  157. // The enum values 17035 is reserved and should NOT be used for new error codes.
  158. /** Indicates that the iOS bundle ID is missing when a iOS App Store ID is provided.
  159. */
  160. FIRAuthErrorCodeMissingIosBundleID = 17036,
  161. /** Indicates that the android package name is missing when the `androidInstallApp` flag is set
  162. to true.
  163. */
  164. FIRAuthErrorCodeMissingAndroidPackageName = 17037,
  165. /** Indicates that the domain specified in the continue URL is not whitelisted in the Firebase
  166. console.
  167. */
  168. FIRAuthErrorCodeUnauthorizedDomain = 17038,
  169. /** Indicates that the domain specified in the continue URI is not valid.
  170. */
  171. FIRAuthErrorCodeInvalidContinueURI = 17039,
  172. /** Indicates that a continue URI was not provided in a request to the backend which requires
  173. one.
  174. */
  175. FIRAuthErrorCodeMissingContinueURI = 17040,
  176. /** Indicates that a phone number was not provided in a call to
  177. `verifyPhoneNumber:completion:`.
  178. */
  179. FIRAuthErrorCodeMissingPhoneNumber = 17041,
  180. /** Indicates that an invalid phone number was provided in a call to
  181. `verifyPhoneNumber:completion:`.
  182. */
  183. FIRAuthErrorCodeInvalidPhoneNumber = 17042,
  184. /** Indicates that the phone auth credential was created with an empty verification code.
  185. */
  186. FIRAuthErrorCodeMissingVerificationCode = 17043,
  187. /** Indicates that an invalid verification code was used in the verifyPhoneNumber request.
  188. */
  189. FIRAuthErrorCodeInvalidVerificationCode = 17044,
  190. /** Indicates that the phone auth credential was created with an empty verification ID.
  191. */
  192. FIRAuthErrorCodeMissingVerificationID = 17045,
  193. /** Indicates that an invalid verification ID was used in the verifyPhoneNumber request.
  194. */
  195. FIRAuthErrorCodeInvalidVerificationID = 17046,
  196. /** Indicates that the APNS device token is missing in the verifyClient request.
  197. */
  198. FIRAuthErrorCodeMissingAppCredential = 17047,
  199. /** Indicates that an invalid APNS device token was used in the verifyClient request.
  200. */
  201. FIRAuthErrorCodeInvalidAppCredential = 17048,
  202. // The enum values between 17048 and 17051 are reserved and should NOT be used for new error
  203. // codes.
  204. /** Indicates that the SMS code has expired.
  205. */
  206. FIRAuthErrorCodeSessionExpired = 17051,
  207. /** Indicates that the quota of SMS messages for a given project has been exceeded.
  208. */
  209. FIRAuthErrorCodeQuotaExceeded = 17052,
  210. /** Indicates that the APNs device token could not be obtained. The app may not have set up
  211. remote notification correctly, or may fail to forward the APNs device token to FIRAuth
  212. if app delegate swizzling is disabled.
  213. */
  214. FIRAuthErrorCodeMissingAppToken = 17053,
  215. /** Indicates that the app fails to forward remote notification to FIRAuth.
  216. */
  217. FIRAuthErrorCodeNotificationNotForwarded = 17054,
  218. /** Indicates that the app could not be verified by Firebase during phone number authentication.
  219. */
  220. FIRAuthErrorCodeAppNotVerified = 17055,
  221. /** Indicates that the reCAPTCHA token is not valid.
  222. */
  223. FIRAuthErrorCodeCaptchaCheckFailed = 17056,
  224. /** Indicates that an attempt was made to present a new web context while one was already being
  225. presented.
  226. */
  227. FIRAuthErrorCodeWebContextAlreadyPresented = 17057,
  228. /** Indicates that the URL presentation was cancelled prematurely by the user.
  229. */
  230. FIRAuthErrorCodeWebContextCancelled = 17058,
  231. /** Indicates a general failure during the app verification flow.
  232. */
  233. FIRAuthErrorCodeAppVerificationUserInteractionFailure = 17059,
  234. /** Indicates that the clientID used to invoke a web flow is invalid.
  235. */
  236. FIRAuthErrorCodeInvalidClientID = 17060,
  237. /** Indicates that a network request within a SFSafariViewController or WKWebView failed.
  238. */
  239. FIRAuthErrorCodeWebNetworkRequestFailed = 17061,
  240. /** Indicates that an internal error occurred within a SFSafariViewController or WKWebView.
  241. */
  242. FIRAuthErrorCodeWebInternalError = 17062,
  243. /** Indicates a general failure during a web sign-in flow.
  244. */
  245. FIRAuthErrorCodeWebSignInUserInteractionFailure = 17063,
  246. /** Indicates that the local player was not authenticated prior to attempting Game Center
  247. signin.
  248. */
  249. FIRAuthErrorCodeLocalPlayerNotAuthenticated = 17066,
  250. /** Indicates that a non-null user was expected as an argmument to the operation but a null
  251. user was provided.
  252. */
  253. FIRAuthErrorCodeNullUser = 17067,
  254. /** Indicates that a Firebase Dynamic Link is not activated.
  255. */
  256. FIRAuthErrorCodeDynamicLinkNotActivated = 17068,
  257. /**
  258. * Represents the error code for when the given provider id for a web operation is invalid.
  259. */
  260. FIRAuthErrorCodeInvalidProviderID = 17071,
  261. /** Indicates that the Firebase Dynamic Link domain used is either not configured or is
  262. unauthorized for the current project.
  263. */
  264. FIRAuthErrorCodeInvalidDynamicLinkDomain = 17074,
  265. /** Indicates that the credential is rejected because it's misformed or mismatching.
  266. */
  267. FIRAuthErrorCodeRejectedCredential = 17075,
  268. /** Indicates that the GameKit framework is not linked prior to attempting Game Center signin.
  269. */
  270. FIRAuthErrorCodeGameKitNotLinked = 17076,
  271. /** Indicates an error for when the client identifier is missing.
  272. */
  273. FIRAuthErrorCodeMissingClientIdentifier = 17993,
  274. /** Indicates an error occurred while attempting to access the keychain.
  275. */
  276. FIRAuthErrorCodeKeychainError = 17995,
  277. /** Indicates an internal error occurred.
  278. */
  279. FIRAuthErrorCodeInternalError = 17999,
  280. /** Raised when a JWT fails to parse correctly. May be accompanied by an underlying error
  281. describing which step of the JWT parsing process failed.
  282. */
  283. FIRAuthErrorCodeMalformedJWT = 18000,
  284. } NS_SWIFT_NAME(AuthErrorCode);
  285. @end
  286. NS_ASSUME_NONNULL_END