FIRAuthBackend.h 28 KB

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