FIRAuthBackend.h 27 KB

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