FIRAuthBackend.h 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680
  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. #import "FirebaseAuth/Sources/Backend/FIRAuthRPCRequest.h"
  18. #import "FirebaseAuth/Sources/Backend/FIRAuthRPCResponse.h"
  19. @class FIRAuthRequestConfiguration;
  20. @class FIRCreateAuthURIRequest;
  21. @class FIRCreateAuthURIResponse;
  22. @class FIRDeleteAccountRequest;
  23. @class FIRDeleteAccountResponse;
  24. @class FIREmailLinkSignInRequest;
  25. @class FIREmailLinkSignInResponse;
  26. @class FIRGetAccountInfoRequest;
  27. @class FIRGetAccountInfoResponse;
  28. @class FIRGetProjectConfigRequest;
  29. @class FIRGetProjectConfigResponse;
  30. @class FIRGetOOBConfirmationCodeRequest;
  31. @class FIRGetOOBConfirmationCodeResponse;
  32. @class FIRResetPasswordRequest;
  33. @class FIRResetPasswordResponse;
  34. @class FIRSecureTokenRequest;
  35. @class FIRSecureTokenResponse;
  36. @class FIRSetAccountInfoRequest;
  37. @class FIRSetAccountInfoResponse;
  38. @class FIRVerifyAssertionRequest;
  39. @class FIRVerifyAssertionResponse;
  40. @class FIRVerifyClientRequest;
  41. @class FIRVerifyClientResponse;
  42. @class FIRVerifyCustomTokenRequest;
  43. @class FIRVerifyCustomTokenResponse;
  44. @class FIRVerifyPasswordRequest;
  45. @class FIRVerifyPasswordResponse;
  46. @class FIRVerifyPhoneNumberRequest;
  47. @class FIRVerifyPhoneNumberResponse;
  48. @class FIRSendVerificationCodeRequest;
  49. @class FIRSendVerificationCodeResponse;
  50. @class FIRSignInWithGameCenterRequest;
  51. @class FIRSignInWithGameCenterResponse;
  52. @class FIRSignUpNewUserRequest;
  53. @class FIRSignUpNewUserResponse;
  54. @class FIRRevokeTokenRequest;
  55. @class FIRRevokeTokenResponse;
  56. @class FIRGetRecaptchaConfigRequest;
  57. @class FIRGetRecaptchaConfigResponse;
  58. @protocol FIRAuthBackendImplementation;
  59. @protocol FIRAuthBackendRPCIssuer;
  60. NS_ASSUME_NONNULL_BEGIN
  61. /** @typedef FIRAuthBackendRPCIssuerCompletionHandler
  62. @brief The type of block used to return the result of a call to an endpoint.
  63. @param data The HTTP response body.
  64. @param error The error which occurred, if any.
  65. @remarks One of response or error will be non-nil.
  66. */
  67. typedef void (^FIRAuthBackendRPCIssuerCompletionHandler)(NSData *_Nullable data,
  68. NSError *_Nullable error);
  69. /** @typedef FIRCreateAuthURIResponseCallback
  70. @brief The type of block used to return the result of a call to the createAuthURI
  71. endpoint.
  72. @param response The received response, if any.
  73. @param error The error which occurred, if any.
  74. @remarks One of response or error will be non-nil.
  75. */
  76. typedef void (^FIRCreateAuthURIResponseCallback)(FIRCreateAuthURIResponse *_Nullable response,
  77. NSError *_Nullable error);
  78. /** @typedef FIRGetAccountInfoResponseCallback
  79. @brief The type of block used to return the result of a call to the getAccountInfo
  80. endpoint.
  81. @param response The received response, if any.
  82. @param error The error which occurred, if any.
  83. @remarks One of response or error will be non-nil.
  84. */
  85. typedef void (^FIRGetAccountInfoResponseCallback)(FIRGetAccountInfoResponse *_Nullable response,
  86. NSError *_Nullable error);
  87. /** @typedef FIRGetProjectConfigResponseCallback
  88. @brief The type of block used to return the result of a call to the getProjectInfo
  89. endpoint.
  90. @param response The received response, if any.
  91. @param error The error which occurred, if any.
  92. @remarks One of response or error will be non-nil.
  93. */
  94. typedef void (^FIRGetProjectConfigResponseCallback)(FIRGetProjectConfigResponse *_Nullable response,
  95. NSError *_Nullable error);
  96. /** @typedef FIRSetAccountInfoResponseCallback
  97. @brief The type of block used to return the result of a call to the setAccountInfo
  98. endpoint.
  99. @param response The received response, if any.
  100. @param error The error which occurred, if any.
  101. @remarks One of response or error will be non-nil.
  102. */
  103. typedef void (^FIRSetAccountInfoResponseCallback)(FIRSetAccountInfoResponse *_Nullable response,
  104. NSError *_Nullable error);
  105. /** @typedef FIRSecureTokenResponseCallback
  106. @brief The type of block used to return the result of a call to the token endpoint.
  107. @param response The received response, if any.
  108. @param error The error which occurred, if any.
  109. @remarks One of response or error will be non-nil.
  110. */
  111. typedef void (^FIRSecureTokenResponseCallback)(FIRSecureTokenResponse *_Nullable response,
  112. NSError *_Nullable error);
  113. /** @typedef FIRVerifyAssertionResponseCallback
  114. @brief The type of block used to return the result of a call to the verifyAssertion
  115. endpoint.
  116. @param response The received response, if any.
  117. @param error The error which occurred, if any.
  118. @remarks One of response or error will be non-nil.
  119. */
  120. typedef void (^FIRVerifyAssertionResponseCallback)(FIRVerifyAssertionResponse *_Nullable response,
  121. NSError *_Nullable error);
  122. /** @typedef FIRVerifyPasswordResponseCallback
  123. @brief The type of block used to return the result of a call to the verifyPassword
  124. endpoint.
  125. @param response The received response, if any.
  126. @param error The error which occurred, if any.
  127. @remarks One of response or error will be non-nil.
  128. */
  129. typedef void (^FIRVerifyPasswordResponseCallback)(FIRVerifyPasswordResponse *_Nullable response,
  130. NSError *_Nullable error);
  131. /** @typedef FIREmailLinkSigninResponseCallback
  132. @brief The type of block used to return the result of a call to the emailLinkSignin
  133. endpoint.
  134. @param response The received response, if any.
  135. @param error The error which occurred, if any.
  136. @remarks One of response or error will be non-nil.
  137. */
  138. typedef void (^FIREmailLinkSigninResponseCallback)(FIREmailLinkSignInResponse *_Nullable response,
  139. NSError *_Nullable error);
  140. /** @typedef FIRVerifyCustomTokenResponseCallback
  141. @brief The type of block used to return the result of a call to the verifyCustomToken
  142. endpoint.
  143. @param response The received response, if any.
  144. @param error The error which occurred, if any.
  145. @remarks One of response or error will be non-nil.
  146. */
  147. typedef void (^FIRVerifyCustomTokenResponseCallback)(
  148. FIRVerifyCustomTokenResponse *_Nullable response, NSError *_Nullable error);
  149. /** @typedef FIRDeleteCallBack
  150. @brief The type of block called when a request delete account has finished.
  151. @param error The error which occurred, or nil if the request was successful.
  152. */
  153. typedef void (^FIRDeleteCallBack)(NSError *_Nullable error);
  154. /** @typedef FIRGetOOBConfirmationCodeResponseCallback
  155. @brief The type of block used to return the result of a call to the getOOBConfirmationCode
  156. endpoint.
  157. @param response The received response, if any.
  158. @param error The error which occurred, if any.
  159. @remarks One of response or error will be non-nil.
  160. */
  161. typedef void (^FIRGetOOBConfirmationCodeResponseCallback)(
  162. FIRGetOOBConfirmationCodeResponse *_Nullable response, NSError *_Nullable error);
  163. /** @typedef FIRSignupNewUserCallback
  164. @brief The type of block used to return the result of a call to the signupNewUser endpoint.
  165. @param response The received response, if any.
  166. @param error The error which occurred, if any.
  167. @remarks One of response or error will be non-nil.
  168. */
  169. typedef void (^FIRSignupNewUserCallback)(FIRSignUpNewUserResponse *_Nullable response,
  170. NSError *_Nullable error);
  171. /** @typedef FIRResetPasswordCallback
  172. @brief The type of block used to return the result of a call to the resetPassword endpoint.
  173. @param response The received response, if any.
  174. @param error The error which occurred, if any.
  175. @remarks One of response or error will be non-nil.
  176. */
  177. typedef void (^FIRResetPasswordCallback)(FIRResetPasswordResponse *_Nullable response,
  178. NSError *_Nullable error);
  179. /** @typedef FIRSendVerificationCodeResponseCallback
  180. @brief The type of block used to return the result of a call to the sendVerificationCode
  181. endpoint.
  182. @param response The received response, if any.
  183. @param error The error which occurred, if any.
  184. @remarks One of response or error will be non-nil.
  185. */
  186. typedef void (^FIRSendVerificationCodeResponseCallback)(
  187. FIRSendVerificationCodeResponse *_Nullable response, NSError *_Nullable error);
  188. /** @typedef FIRVerifyPhoneNumberResponseCallback
  189. @brief The type of block used to return the result of a call to the verifyPhoneNumber endpoint.
  190. @param response The received response, if any.
  191. @param error The error which occurred, if any.
  192. @remarks One of response or error will be non-nil.
  193. */
  194. typedef void (^FIRVerifyPhoneNumberResponseCallback)(
  195. FIRVerifyPhoneNumberResponse *_Nullable response, NSError *_Nullable error);
  196. /** @typedef FIRVerifyClientResponseCallback
  197. @brief The type of block used to return the result of a call to the verifyClient endpoint.
  198. @param response The received response, if any.
  199. @param error The error which occurred, if any.
  200. @remarks One of response or error will be non-nil.
  201. */
  202. typedef void (^FIRVerifyClientResponseCallback)(FIRVerifyClientResponse *_Nullable response,
  203. NSError *_Nullable error);
  204. /** @typedef FIRRevokeTokenResponseCallback
  205. @brief The type of block used to return the result of a call to the revokeToken endpoint.
  206. @param response The received response, if any.
  207. @param error The error which occurred, if any.
  208. @remarks One of response or error will be non-nil.
  209. */
  210. typedef void (^FIRRevokeTokenResponseCallback)(FIRRevokeTokenResponse *_Nullable response,
  211. NSError *_Nullable error);
  212. /** @typedef FIRSignInWithGameCenterResponseCallback
  213. @brief The type of block used to return the result of a call to the SignInWithGameCenter
  214. endpoint.
  215. @param response The received response, if any.
  216. @param error The error which occurred, if any.
  217. @remarks One of response or error will be non-nil.
  218. */
  219. typedef void (^FIRSignInWithGameCenterResponseCallback)(
  220. FIRSignInWithGameCenterResponse *_Nullable response, NSError *_Nullable error);
  221. /** @typedef FIRGetRecaptchaConfigResponseCallback
  222. @brief The type of block used to return the result of a call to the getRecaptchaConfig endpoint.
  223. @param response The received response, if any.
  224. @param error The error which occurred, if any.
  225. @remarks One of response or error will be non-nil.
  226. */
  227. typedef void (^FIRGetRecaptchaConfigResponseCallback)(
  228. FIRGetRecaptchaConfigResponse *_Nullable response, NSError *_Nullable error);
  229. /** @class FIRAuthBackend
  230. @brief Simple static class with methods representing the backend RPCs.
  231. @remarks All callback blocks passed as method parameters are invoked asynchronously on the
  232. global work queue in the future. See
  233. https://github.com/firebase/firebase-ios-sdk/tree/master/FirebaseAuth/Docs/threading.md
  234. */
  235. @interface FIRAuthBackend : NSObject
  236. /** @fn authUserAgent
  237. @brief Retrieves the Firebase Auth user agent.
  238. @return The Firebase Auth user agent.
  239. */
  240. + (NSString *)authUserAgent;
  241. + (id<FIRAuthBackendImplementation>)implementation;
  242. /** @fn setBackendImplementation:
  243. @brief Changes the default backend implementation to something else.
  244. @param backendImplementation The backend implementation to use.
  245. @remarks This is not, generally, safe to call in a scenario where other backend requests may
  246. be occuring. This is specifically to help mock the backend for testing purposes.
  247. */
  248. + (void)setBackendImplementation:(id<FIRAuthBackendImplementation>)backendImplementation;
  249. /** @fn setDefaultBackendImplementationWithRPCIssuer:
  250. @brief Uses the default backend implementation, but with a custom RPC issuer.
  251. @param RPCIssuer The RPC issuer to use. If @c nil, will use the default implementation.
  252. @remarks This is not, generally, safe to call in a scenario where other backend requests may
  253. be occuring. This is specifically to help test the backend interfaces (requests, responses,
  254. and shared FIRAuthBackend logic.)
  255. */
  256. + (void)setDefaultBackendImplementationWithRPCIssuer:
  257. (nullable id<FIRAuthBackendRPCIssuer>)RPCIssuer;
  258. /** @fn createAuthURI:callback:
  259. @brief Calls the createAuthURI endpoint, which is responsible for creating the URI used by the
  260. IdP to authenticate the user.
  261. @param request The request parameters.
  262. @param callback The callback.
  263. */
  264. + (void)createAuthURI:(FIRCreateAuthURIRequest *)request
  265. callback:(FIRCreateAuthURIResponseCallback)callback;
  266. /** @fn getAccountInfo:callback:
  267. @brief Calls the getAccountInfo endpoint, which returns account info for a given account.
  268. @param request The request parameters.
  269. @param callback The callback.
  270. */
  271. + (void)getAccountInfo:(FIRGetAccountInfoRequest *)request
  272. callback:(FIRGetAccountInfoResponseCallback)callback;
  273. /** @fn getProjectConfig:callback:
  274. @brief Calls the getProjectConfig endpoint, which returns configuration information for a given
  275. project.
  276. @param request An object wrapping the backend get request.
  277. @param callback The callback.
  278. */
  279. + (void)getProjectConfig:(FIRGetProjectConfigRequest *)request
  280. callback:(FIRGetProjectConfigResponseCallback)callback;
  281. /** @fn setAccountInfo:callback:
  282. @brief Calls the setAccountInfo endpoint, which is responsible for setting account info for a
  283. user, for example, to sign up a new user with email and password.
  284. @param request The request parameters.
  285. @param callback The callback.
  286. */
  287. + (void)setAccountInfo:(FIRSetAccountInfoRequest *)request
  288. callback:(FIRSetAccountInfoResponseCallback)callback;
  289. /** @fn verifyAssertion:callback:
  290. @brief Calls the verifyAssertion endpoint, which is responsible for authenticating a
  291. user who has IDP-related credentials (an ID Token, an Access Token, etc.)
  292. @param request The request parameters.
  293. @param callback The callback.
  294. */
  295. + (void)verifyAssertion:(FIRVerifyAssertionRequest *)request
  296. callback:(FIRVerifyAssertionResponseCallback)callback;
  297. /** @fn verifyCustomToken:callback:
  298. @brief Calls the verifyCustomToken endpoint, which is responsible for authenticating a
  299. user who has BYOAuth credentials (a self-signed token using their BYOAuth private key.)
  300. @param request The request parameters.
  301. @param callback The callback.
  302. */
  303. + (void)verifyCustomToken:(FIRVerifyCustomTokenRequest *)request
  304. callback:(FIRVerifyCustomTokenResponseCallback)callback;
  305. /** @fn verifyPassword:callback:
  306. @brief Calls the verifyPassword endpoint, which is responsible for authenticating a
  307. user who has email and password credentials.
  308. @param request The request parameters.
  309. @param callback The callback.
  310. */
  311. + (void)verifyPassword:(FIRVerifyPasswordRequest *)request
  312. callback:(FIRVerifyPasswordResponseCallback)callback;
  313. /** @fn emailLinkSignin:callback:
  314. @brief Calls the emailLinkSignin endpoint, which is responsible for authenticating a
  315. user through passwordless sign-in.
  316. @param request The request parameters.
  317. @param callback The callback.
  318. */
  319. + (void)emailLinkSignin:(FIREmailLinkSignInRequest *)request
  320. callback:(FIREmailLinkSigninResponseCallback)callback;
  321. /** @fn secureToken:callback:
  322. @brief Calls the token endpoint, which is responsible for performing STS token exchanges and
  323. token refreshes.
  324. @param request The request parameters.
  325. @param callback The callback.
  326. */
  327. + (void)secureToken:(FIRSecureTokenRequest *)request
  328. callback:(FIRSecureTokenResponseCallback)callback;
  329. /** @fn getOOBConfirmationCode:callback:
  330. @brief Calls the getOOBConfirmationCode endpoint, which is responsible for sending email change
  331. request emails, and password reset emails.
  332. @param request The request parameters.
  333. @param callback The callback.
  334. */
  335. + (void)getOOBConfirmationCode:(FIRGetOOBConfirmationCodeRequest *)request
  336. callback:(FIRGetOOBConfirmationCodeResponseCallback)callback;
  337. /** @fn signUpNewUser:
  338. @brief Calls the signUpNewUser endpoint, which is responsible anonymously signing up a user
  339. or signing in a user anonymously.
  340. @param request The request parameters.
  341. @param callback The callback.
  342. */
  343. + (void)signUpNewUser:(FIRSignUpNewUserRequest *)request
  344. callback:(FIRSignupNewUserCallback)callback;
  345. /** @fn resetPassword:callback
  346. @brief Calls the resetPassword endpoint, which is responsible for resetting a user's password
  347. given an OOB code and new password.
  348. @param request The request parameters.
  349. @param callback The callback.
  350. */
  351. + (void)resetPassword:(FIRResetPasswordRequest *)request
  352. callback:(FIRResetPasswordCallback)callback;
  353. /** @fn deleteAccount:
  354. @brief Calls the DeleteAccount endpoint, which is responsible for deleting a user.
  355. @param request The request parameters.
  356. @param callback The callback.
  357. */
  358. + (void)deleteAccount:(FIRDeleteAccountRequest *)request callback:(FIRDeleteCallBack)callback;
  359. /** @fn SignInWithGameCenter:callback:
  360. @brief Calls the SignInWithGameCenter endpoint, which is responsible for authenticating a user
  361. who has Game Center credentials.
  362. @param request The request parameters.
  363. @param callback The callback.
  364. */
  365. + (void)signInWithGameCenter:(FIRSignInWithGameCenterRequest *)request
  366. callback:(FIRSignInWithGameCenterResponseCallback)callback;
  367. /** @fn getRecaptchaConfig:callback:
  368. @brief Calls the getRecaptchaConfig endpoint, which is responsible for retrieving the recaptcha
  369. configs including site key, provider enablement status.
  370. @param request The request parameters.
  371. @param callback The callback.
  372. */
  373. + (void)getRecaptchaConfig:(FIRGetRecaptchaConfigRequest *)request
  374. callback:(FIRGetRecaptchaConfigResponseCallback)callback;
  375. #if TARGET_OS_IOS
  376. /** @fn sendVerificationCode:callback:
  377. @brief Calls the sendVerificationCode endpoint, which is responsible for sending the
  378. verification code to a phone number specified in the request parameters.
  379. @param request The request parameters.
  380. @param callback The callback.
  381. */
  382. + (void)sendVerificationCode:(FIRSendVerificationCodeRequest *)request
  383. callback:(FIRSendVerificationCodeResponseCallback)callback;
  384. /** @fn verifyPhoneNumber:callback:
  385. @brief Calls the verifyPhoneNumber endpoint, which is responsible for sending the verification
  386. code to a phone number specified in the request parameters.
  387. @param request The request parameters.
  388. @param callback The callback.
  389. */
  390. + (void)verifyPhoneNumber:(FIRVerifyPhoneNumberRequest *)request
  391. callback:(FIRVerifyPhoneNumberResponseCallback)callback;
  392. /** @fn verifyClient:callback:
  393. @brief Calls the verifyClient endpoint, which is responsible for sending the silent push
  394. notification used for app validation to the device provided in the request parameters.
  395. @param request The request parameters.
  396. @param callback The callback.
  397. */
  398. + (void)verifyClient:(FIRVerifyClientRequest *)request
  399. callback:(FIRVerifyClientResponseCallback)callback;
  400. #endif
  401. /** @fn revokeToken:callback:
  402. @brief Calls the revokeToken endpoint, which is responsible for revoking the given token
  403. provided in the request parameters.
  404. @param request The request parameters.
  405. @param callback The callback.
  406. */
  407. + (void)revokeToken:(FIRRevokeTokenRequest *)request
  408. callback:(FIRRevokeTokenResponseCallback)callback;
  409. @end
  410. /** @protocol FIRAuthBackendRPCIssuer
  411. @brief Used to make FIRAuthBackend
  412. */
  413. @protocol FIRAuthBackendRPCIssuer <NSObject>
  414. /** @fn asyncCallToURLWithRequestConfiguration:URL:body:contentType:completionHandler:
  415. @brief Asynchronously sends a HTTP request.
  416. @param requestConfiguration The request to be made.
  417. @param URL The request URL.
  418. @param body Request body.
  419. @param contentType Content type of the body.
  420. @param handler provided that handles HTTP response. Invoked asynchronously on the auth global
  421. work queue in the future.
  422. */
  423. - (void)asyncCallToURLWithRequestConfiguration:(FIRAuthRequestConfiguration *)requestConfiguration
  424. URL:(NSURL *)URL
  425. body:(nullable NSData *)body
  426. contentType:(NSString *)contentType
  427. completionHandler:(FIRAuthBackendRPCIssuerCompletionHandler)handler;
  428. @end
  429. /** @protocol FIRAuthBackendImplementation
  430. @brief Used to make FIRAuthBackend provide a layer of indirection to an actual RPC-based backend
  431. or a mock backend.
  432. */
  433. @protocol FIRAuthBackendImplementation <NSObject>
  434. /** @fn createAuthURI:callback:
  435. @brief Calls the createAuthURI endpoint, which is responsible for creating the URI used by the
  436. IdP to authenticate the user.
  437. @param request The request parameters.
  438. @param callback The callback.
  439. */
  440. - (void)createAuthURI:(FIRCreateAuthURIRequest *)request
  441. callback:(FIRCreateAuthURIResponseCallback)callback;
  442. /** @fn getAccountInfo:callback:
  443. @brief Calls the getAccountInfo endpoint, which returns account info for a given account.
  444. @param request The request parameters.
  445. @param callback The callback.
  446. */
  447. - (void)getAccountInfo:(FIRGetAccountInfoRequest *)request
  448. callback:(FIRGetAccountInfoResponseCallback)callback;
  449. /** @fn getProjectConfig:callback:
  450. @brief Calls the getProjectInfo endpoint, which returns configuration information for a given
  451. project.
  452. @param request The request parameters.
  453. @param callback The callback.
  454. */
  455. - (void)getProjectConfig:(FIRGetProjectConfigRequest *)request
  456. callback:(FIRGetProjectConfigResponseCallback)callback;
  457. /** @fn setAccountInfo:callback:
  458. @brief Calls the setAccountInfo endpoint, which is responsible for setting account info for a
  459. user, for example, to sign up a new user with email and password.
  460. @param request The request parameters.
  461. @param callback The callback.
  462. */
  463. - (void)setAccountInfo:(FIRSetAccountInfoRequest *)request
  464. callback:(FIRSetAccountInfoResponseCallback)callback;
  465. /** @fn verifyAssertion:callback:
  466. @brief Calls the verifyAssertion endpoint, which is responsible for authenticating a
  467. user who has IDP-related credentials (an ID Token, an Access Token, etc.)
  468. @param request The request parameters.
  469. @param callback The callback.
  470. */
  471. - (void)verifyAssertion:(FIRVerifyAssertionRequest *)request
  472. callback:(FIRVerifyAssertionResponseCallback)callback;
  473. /** @fn verifyCustomToken:callback:
  474. @brief Calls the verifyCustomToken endpoint, which is responsible for authenticating a
  475. user who has BYOAuth credentials (a self-signed token using their BYOAuth private key.)
  476. @param request The request parameters.
  477. @param callback The callback.
  478. */
  479. - (void)verifyCustomToken:(FIRVerifyCustomTokenRequest *)request
  480. callback:(FIRVerifyCustomTokenResponseCallback)callback;
  481. /** @fn verifyPassword:callback:
  482. @brief Calls the verifyPassword endpoint, which is responsible for authenticating a
  483. user who has email and password credentials.
  484. @param request The request parameters.
  485. @param callback The callback.
  486. */
  487. - (void)verifyPassword:(FIRVerifyPasswordRequest *)request
  488. callback:(FIRVerifyPasswordResponseCallback)callback;
  489. /** @fn emailLinkSignin:callback:
  490. @brief Calls the emailLinkSignin endpoint, which is responsible for authenticating a
  491. user through passwordless sign-in.
  492. @param request The request parameters.
  493. @param callback The callback.
  494. */
  495. - (void)emailLinkSignin:(FIREmailLinkSignInRequest *)request
  496. callback:(FIREmailLinkSigninResponseCallback)callback;
  497. /** @fn secureToken:callback:
  498. @brief Calls the token endpoint, which is responsible for performing STS token exchanges and
  499. token refreshes.
  500. @param request The request parameters.
  501. @param callback The callback.
  502. */
  503. - (void)secureToken:(FIRSecureTokenRequest *)request
  504. callback:(FIRSecureTokenResponseCallback)callback;
  505. /** @fn getOOBConfirmationCode:callback:
  506. @brief Calls the getOOBConfirmationCode endpoint, which is responsible for sending email change
  507. request emails, email sign-in link emails, and password reset emails.
  508. @param request The request parameters.
  509. @param callback The callback.
  510. */
  511. - (void)getOOBConfirmationCode:(FIRGetOOBConfirmationCodeRequest *)request
  512. callback:(FIRGetOOBConfirmationCodeResponseCallback)callback;
  513. /** @fn signUpNewUser:
  514. @brief Calls the signUpNewUser endpoint, which is responsible anonymously signing up a user
  515. or signing in a user anonymously.
  516. @param request The request parameters.
  517. @param callback The callback.
  518. */
  519. - (void)signUpNewUser:(FIRSignUpNewUserRequest *)request
  520. callback:(FIRSignupNewUserCallback)callback;
  521. /** @fn deleteAccount:
  522. @brief Calls the DeleteAccount endpoint, which is responsible for deleting a user.
  523. @param request The request parameters.
  524. @param callback The callback.
  525. */
  526. - (void)deleteAccount:(FIRDeleteAccountRequest *)request callback:(FIRDeleteCallBack)callback;
  527. #if TARGET_OS_IOS
  528. /** @fn sendVerificationCode:callback:
  529. @brief Calls the sendVerificationCode endpoint, which is responsible for sending the
  530. verification code to a phone number specified in the request parameters.
  531. @param request The request parameters.
  532. @param callback The callback.
  533. */
  534. - (void)sendVerificationCode:(FIRSendVerificationCodeRequest *)request
  535. callback:(FIRSendVerificationCodeResponseCallback)callback;
  536. /** @fn verifyPhoneNumber:callback:
  537. @brief Calls the verifyPhoneNumber endpoint, which is responsible for sending the verification
  538. code to a phone number specified in the request parameters.
  539. @param request The request parameters.
  540. @param callback The callback.
  541. */
  542. - (void)verifyPhoneNumber:(FIRVerifyPhoneNumberRequest *)request
  543. callback:(FIRVerifyPhoneNumberResponseCallback)callback;
  544. /** @fn verifyClient:callback:
  545. @brief Calls the verifyClient endpoint, which is responsible for sending the silent push
  546. notification used for app validation to the device provided in the request parameters.
  547. @param request The request parameters.
  548. @param callback The callback.
  549. */
  550. - (void)verifyClient:(FIRVerifyClientRequest *)request
  551. callback:(FIRVerifyClientResponseCallback)callback;
  552. #endif
  553. /** @fn revokeToken:callback:
  554. @brief Calls the revokeToken endpoint, which is responsible for revoking the given token
  555. provided in the request parameters.
  556. @param request The request parameters.
  557. @param callback The callback.
  558. */
  559. - (void)revokeToken:(FIRRevokeTokenRequest *)request
  560. callback:(FIRRevokeTokenResponseCallback)callback;
  561. /** @fn SignInWithGameCenter:callback:
  562. @brief Calls the SignInWithGameCenter endpoint, which is responsible for authenticating a user
  563. who has Game Center credentials.
  564. @param request The request parameters.
  565. @param callback The callback.
  566. */
  567. - (void)signInWithGameCenter:(FIRSignInWithGameCenterRequest *)request
  568. callback:(FIRSignInWithGameCenterResponseCallback)callback;
  569. /** @fn getRecaptchaConfig:callback:
  570. @brief Calls the getRecaptchaConfig endpoint, which is responsible for retrieving the recaptcha
  571. configs including site key, provider enablement status.
  572. @param request The request parameters.
  573. @param callback The callback.
  574. */
  575. - (void)getRecaptchaConfig:(FIRGetRecaptchaConfigRequest *)request
  576. callback:(FIRGetRecaptchaConfigResponseCallback)callback;
  577. /** @fn resetPassword:callback
  578. @brief Calls the resetPassword endpoint, which is responsible for resetting a user's password
  579. given an OOB code and new password.
  580. @param request The request parameters.
  581. @param callback The callback.
  582. */
  583. - (void)resetPassword:(FIRResetPasswordRequest *)request
  584. callback:(FIRResetPasswordCallback)callback;
  585. /** @fn callWithRequest:response:callback:
  586. @brief Calls the RPC using HTTP request.
  587. @remarks Possible error responses:
  588. @see FIRAuthInternalErrorCodeRPCRequestEncodingError
  589. @see FIRAuthInternalErrorCodeJSONSerializationError
  590. @see FIRAuthInternalErrorCodeNetworkError
  591. @see FIRAuthInternalErrorCodeUnexpectedErrorResponse
  592. @see FIRAuthInternalErrorCodeUnexpectedResponse
  593. @see FIRAuthInternalErrorCodeRPCResponseDecodingError
  594. @param request The request.
  595. @param response The empty response to be filled.
  596. @param callback The callback for both success and failure.
  597. */
  598. - (void)callWithRequest:(id<FIRAuthRPCRequest>)request
  599. response:(id<FIRAuthRPCResponse>)response
  600. callback:(void (^)(NSError *_Nullable error))callback;
  601. @end
  602. NS_ASSUME_NONNULL_END