@firebase/auth 1.6.2 → 1.7.0-canary.42fcdfe4c

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (236) hide show
  1. package/dist/auth-public.d.ts +60 -10
  2. package/dist/auth.d.ts +61 -10
  3. package/dist/browser-cjs/{index-6a907fc6.js → index-fcf80d66.js} +202 -22
  4. package/dist/browser-cjs/index-fcf80d66.js.map +1 -0
  5. package/dist/browser-cjs/index.js +2 -2
  6. package/dist/browser-cjs/internal.js +1 -1
  7. package/dist/browser-cjs/src/core/auth/auth_impl.d.ts +1 -0
  8. package/dist/browser-cjs/src/core/index.d.ts +9 -1
  9. package/dist/browser-cjs/src/core/strategies/anonymous.d.ts +3 -0
  10. package/dist/browser-cjs/src/core/strategies/credential.d.ts +6 -0
  11. package/dist/browser-cjs/src/core/strategies/custom_token.d.ts +3 -0
  12. package/dist/browser-cjs/src/core/strategies/email_and_password.d.ts +7 -0
  13. package/dist/browser-cjs/src/core/strategies/email_link.d.ts +4 -0
  14. package/dist/browser-cjs/src/core/user/account_info.d.ts +3 -0
  15. package/dist/browser-cjs/src/core/user/reload.d.ts +3 -1
  16. package/dist/browser-cjs/src/core/user/token_manager.d.ts +1 -0
  17. package/dist/browser-cjs/src/core/user/user_impl.d.ts +7 -1
  18. package/dist/browser-cjs/src/core/util/assert.d.ts +1 -0
  19. package/dist/browser-cjs/src/model/public_types.d.ts +7 -0
  20. package/dist/browser-cjs/src/platform_browser/strategies/phone.d.ts +6 -3
  21. package/dist/browser-cjs/src/platform_browser/strategies/popup.d.ts +4 -2
  22. package/dist/browser-cjs/src/platform_browser/strategies/redirect.d.ts +8 -4
  23. package/dist/browser-cjs/test/helpers/integration/helpers.d.ts +2 -0
  24. package/dist/browser-cjs/test/integration/flows/firebaseserverapp.test.d.ts +17 -0
  25. package/dist/cordova/index.js +2 -2
  26. package/dist/cordova/internal.js +45 -17
  27. package/dist/cordova/internal.js.map +1 -1
  28. package/dist/cordova/{popup_redirect-58faecee.js → popup_redirect-65e04583.js} +197 -17
  29. package/dist/cordova/popup_redirect-65e04583.js.map +1 -0
  30. package/dist/cordova/src/core/auth/auth_impl.d.ts +1 -0
  31. package/dist/cordova/src/core/index.d.ts +9 -1
  32. package/dist/cordova/src/core/strategies/anonymous.d.ts +3 -0
  33. package/dist/cordova/src/core/strategies/credential.d.ts +6 -0
  34. package/dist/cordova/src/core/strategies/custom_token.d.ts +3 -0
  35. package/dist/cordova/src/core/strategies/email_and_password.d.ts +7 -0
  36. package/dist/cordova/src/core/strategies/email_link.d.ts +4 -0
  37. package/dist/cordova/src/core/user/account_info.d.ts +3 -0
  38. package/dist/cordova/src/core/user/reload.d.ts +3 -1
  39. package/dist/cordova/src/core/user/token_manager.d.ts +1 -0
  40. package/dist/cordova/src/core/user/user_impl.d.ts +7 -1
  41. package/dist/cordova/src/core/util/assert.d.ts +1 -0
  42. package/dist/cordova/src/model/public_types.d.ts +7 -0
  43. package/dist/cordova/src/platform_browser/strategies/phone.d.ts +6 -3
  44. package/dist/cordova/src/platform_browser/strategies/popup.d.ts +4 -2
  45. package/dist/cordova/src/platform_browser/strategies/redirect.d.ts +8 -4
  46. package/dist/cordova/test/helpers/integration/helpers.d.ts +2 -0
  47. package/dist/cordova/test/integration/flows/firebaseserverapp.test.d.ts +17 -0
  48. package/dist/esm2017/{index-e939beb5.js → index-3ad9a9b9.js} +202 -22
  49. package/dist/esm2017/index-3ad9a9b9.js.map +1 -0
  50. package/dist/esm2017/index.js +2 -2
  51. package/dist/esm2017/internal.js +2 -2
  52. package/dist/esm2017/src/core/auth/auth_impl.d.ts +1 -0
  53. package/dist/esm2017/src/core/index.d.ts +9 -1
  54. package/dist/esm2017/src/core/strategies/anonymous.d.ts +3 -0
  55. package/dist/esm2017/src/core/strategies/credential.d.ts +6 -0
  56. package/dist/esm2017/src/core/strategies/custom_token.d.ts +3 -0
  57. package/dist/esm2017/src/core/strategies/email_and_password.d.ts +7 -0
  58. package/dist/esm2017/src/core/strategies/email_link.d.ts +4 -0
  59. package/dist/esm2017/src/core/user/account_info.d.ts +3 -0
  60. package/dist/esm2017/src/core/user/reload.d.ts +3 -1
  61. package/dist/esm2017/src/core/user/token_manager.d.ts +1 -0
  62. package/dist/esm2017/src/core/user/user_impl.d.ts +7 -1
  63. package/dist/esm2017/src/core/util/assert.d.ts +1 -0
  64. package/dist/esm2017/src/model/public_types.d.ts +7 -0
  65. package/dist/esm2017/src/platform_browser/strategies/phone.d.ts +6 -3
  66. package/dist/esm2017/src/platform_browser/strategies/popup.d.ts +4 -2
  67. package/dist/esm2017/src/platform_browser/strategies/redirect.d.ts +8 -4
  68. package/dist/esm2017/test/helpers/integration/helpers.d.ts +2 -0
  69. package/dist/esm2017/test/integration/flows/firebaseserverapp.test.d.ts +17 -0
  70. package/dist/esm5/{index-3bd54529.js → index-dcfb76ea.js} +238 -30
  71. package/dist/esm5/index-dcfb76ea.js.map +1 -0
  72. package/dist/esm5/index.js +2 -2
  73. package/dist/esm5/internal.js +2 -2
  74. package/dist/esm5/src/core/auth/auth_impl.d.ts +1 -0
  75. package/dist/esm5/src/core/index.d.ts +9 -1
  76. package/dist/esm5/src/core/strategies/anonymous.d.ts +3 -0
  77. package/dist/esm5/src/core/strategies/credential.d.ts +6 -0
  78. package/dist/esm5/src/core/strategies/custom_token.d.ts +3 -0
  79. package/dist/esm5/src/core/strategies/email_and_password.d.ts +7 -0
  80. package/dist/esm5/src/core/strategies/email_link.d.ts +4 -0
  81. package/dist/esm5/src/core/user/account_info.d.ts +3 -0
  82. package/dist/esm5/src/core/user/reload.d.ts +3 -1
  83. package/dist/esm5/src/core/user/token_manager.d.ts +1 -0
  84. package/dist/esm5/src/core/user/user_impl.d.ts +7 -1
  85. package/dist/esm5/src/core/util/assert.d.ts +1 -0
  86. package/dist/esm5/src/model/public_types.d.ts +7 -0
  87. package/dist/esm5/src/platform_browser/strategies/phone.d.ts +6 -3
  88. package/dist/esm5/src/platform_browser/strategies/popup.d.ts +4 -2
  89. package/dist/esm5/src/platform_browser/strategies/redirect.d.ts +8 -4
  90. package/dist/esm5/test/helpers/integration/helpers.d.ts +2 -0
  91. package/dist/esm5/test/integration/flows/firebaseserverapp.test.d.ts +17 -0
  92. package/dist/index.webworker.esm5.js +178 -11
  93. package/dist/index.webworker.esm5.js.map +1 -1
  94. package/dist/node/index.js +2 -2
  95. package/dist/node/internal.js +4 -1
  96. package/dist/node/internal.js.map +1 -1
  97. package/dist/node/src/core/auth/auth_impl.d.ts +1 -0
  98. package/dist/node/src/core/index.d.ts +9 -1
  99. package/dist/node/src/core/strategies/anonymous.d.ts +3 -0
  100. package/dist/node/src/core/strategies/credential.d.ts +6 -0
  101. package/dist/node/src/core/strategies/custom_token.d.ts +3 -0
  102. package/dist/node/src/core/strategies/email_and_password.d.ts +7 -0
  103. package/dist/node/src/core/strategies/email_link.d.ts +4 -0
  104. package/dist/node/src/core/user/account_info.d.ts +3 -0
  105. package/dist/node/src/core/user/reload.d.ts +3 -1
  106. package/dist/node/src/core/user/token_manager.d.ts +1 -0
  107. package/dist/node/src/core/user/user_impl.d.ts +7 -1
  108. package/dist/node/src/core/util/assert.d.ts +1 -0
  109. package/dist/node/src/model/public_types.d.ts +7 -0
  110. package/dist/node/src/platform_browser/strategies/phone.d.ts +6 -3
  111. package/dist/node/src/platform_browser/strategies/popup.d.ts +4 -2
  112. package/dist/node/src/platform_browser/strategies/redirect.d.ts +8 -4
  113. package/dist/node/test/helpers/integration/helpers.d.ts +2 -0
  114. package/dist/node/test/integration/flows/firebaseserverapp.test.d.ts +17 -0
  115. package/dist/node/{totp-7d693c11.js → totp-fbe187a4.js} +180 -12
  116. package/dist/node/totp-fbe187a4.js.map +1 -0
  117. package/dist/node-esm/index.js +2 -2
  118. package/dist/node-esm/internal.js +6 -3
  119. package/dist/node-esm/internal.js.map +1 -1
  120. package/dist/node-esm/src/core/auth/auth_impl.d.ts +1 -0
  121. package/dist/node-esm/src/core/index.d.ts +9 -1
  122. package/dist/node-esm/src/core/strategies/anonymous.d.ts +3 -0
  123. package/dist/node-esm/src/core/strategies/credential.d.ts +6 -0
  124. package/dist/node-esm/src/core/strategies/custom_token.d.ts +3 -0
  125. package/dist/node-esm/src/core/strategies/email_and_password.d.ts +7 -0
  126. package/dist/node-esm/src/core/strategies/email_link.d.ts +4 -0
  127. package/dist/node-esm/src/core/user/account_info.d.ts +3 -0
  128. package/dist/node-esm/src/core/user/reload.d.ts +3 -1
  129. package/dist/node-esm/src/core/user/token_manager.d.ts +1 -0
  130. package/dist/node-esm/src/core/user/user_impl.d.ts +7 -1
  131. package/dist/node-esm/src/core/util/assert.d.ts +1 -0
  132. package/dist/node-esm/src/model/public_types.d.ts +7 -0
  133. package/dist/node-esm/src/platform_browser/strategies/phone.d.ts +6 -3
  134. package/dist/node-esm/src/platform_browser/strategies/popup.d.ts +4 -2
  135. package/dist/node-esm/src/platform_browser/strategies/redirect.d.ts +8 -4
  136. package/dist/node-esm/test/helpers/integration/helpers.d.ts +2 -0
  137. package/dist/node-esm/test/integration/flows/firebaseserverapp.test.d.ts +17 -0
  138. package/dist/node-esm/{totp-56a8eeec.js → totp-4d1c9ab1.js} +148 -7
  139. package/dist/node-esm/totp-4d1c9ab1.js.map +1 -0
  140. package/dist/rn/{index-8ee80bdc.js → index-bbdaa838.js} +199 -16
  141. package/dist/rn/index-bbdaa838.js.map +1 -0
  142. package/dist/rn/index.js +1 -1
  143. package/dist/rn/internal.js +41 -15
  144. package/dist/rn/internal.js.map +1 -1
  145. package/dist/rn/src/core/auth/auth_impl.d.ts +1 -0
  146. package/dist/rn/src/core/index.d.ts +9 -1
  147. package/dist/rn/src/core/strategies/anonymous.d.ts +3 -0
  148. package/dist/rn/src/core/strategies/credential.d.ts +6 -0
  149. package/dist/rn/src/core/strategies/custom_token.d.ts +3 -0
  150. package/dist/rn/src/core/strategies/email_and_password.d.ts +7 -0
  151. package/dist/rn/src/core/strategies/email_link.d.ts +4 -0
  152. package/dist/rn/src/core/user/account_info.d.ts +3 -0
  153. package/dist/rn/src/core/user/reload.d.ts +3 -1
  154. package/dist/rn/src/core/user/token_manager.d.ts +1 -0
  155. package/dist/rn/src/core/user/user_impl.d.ts +7 -1
  156. package/dist/rn/src/core/util/assert.d.ts +1 -0
  157. package/dist/rn/src/model/public_types.d.ts +7 -0
  158. package/dist/rn/src/platform_browser/strategies/phone.d.ts +6 -3
  159. package/dist/rn/src/platform_browser/strategies/popup.d.ts +4 -2
  160. package/dist/rn/src/platform_browser/strategies/redirect.d.ts +8 -4
  161. package/dist/rn/test/helpers/integration/helpers.d.ts +2 -0
  162. package/dist/rn/test/integration/flows/firebaseserverapp.test.d.ts +17 -0
  163. package/dist/src/core/auth/auth_impl.d.ts +1 -0
  164. package/dist/src/core/index.d.ts +9 -1
  165. package/dist/src/core/strategies/anonymous.d.ts +3 -0
  166. package/dist/src/core/strategies/credential.d.ts +6 -0
  167. package/dist/src/core/strategies/custom_token.d.ts +3 -0
  168. package/dist/src/core/strategies/email_and_password.d.ts +7 -0
  169. package/dist/src/core/strategies/email_link.d.ts +4 -0
  170. package/dist/src/core/user/account_info.d.ts +3 -0
  171. package/dist/src/core/user/reload.d.ts +3 -1
  172. package/dist/src/core/user/token_manager.d.ts +1 -0
  173. package/dist/src/core/user/user_impl.d.ts +7 -1
  174. package/dist/src/core/util/assert.d.ts +1 -0
  175. package/dist/src/model/public_types.d.ts +7 -0
  176. package/dist/src/platform_browser/strategies/phone.d.ts +6 -3
  177. package/dist/src/platform_browser/strategies/popup.d.ts +4 -2
  178. package/dist/src/platform_browser/strategies/redirect.d.ts +8 -4
  179. package/dist/test/helpers/integration/helpers.d.ts +2 -0
  180. package/dist/test/integration/flows/firebaseserverapp.test.d.ts +17 -0
  181. package/dist/web-extension-cjs/index.js +1 -1
  182. package/dist/web-extension-cjs/internal.js +57 -18
  183. package/dist/web-extension-cjs/internal.js.map +1 -1
  184. package/dist/web-extension-cjs/{register-9438f377.js → register-4ce22251.js} +148 -6
  185. package/dist/web-extension-cjs/register-4ce22251.js.map +1 -0
  186. package/dist/web-extension-cjs/src/core/auth/auth_impl.d.ts +1 -0
  187. package/dist/web-extension-cjs/src/core/index.d.ts +9 -1
  188. package/dist/web-extension-cjs/src/core/strategies/anonymous.d.ts +3 -0
  189. package/dist/web-extension-cjs/src/core/strategies/credential.d.ts +6 -0
  190. package/dist/web-extension-cjs/src/core/strategies/custom_token.d.ts +3 -0
  191. package/dist/web-extension-cjs/src/core/strategies/email_and_password.d.ts +7 -0
  192. package/dist/web-extension-cjs/src/core/strategies/email_link.d.ts +4 -0
  193. package/dist/web-extension-cjs/src/core/user/account_info.d.ts +3 -0
  194. package/dist/web-extension-cjs/src/core/user/reload.d.ts +3 -1
  195. package/dist/web-extension-cjs/src/core/user/token_manager.d.ts +1 -0
  196. package/dist/web-extension-cjs/src/core/user/user_impl.d.ts +7 -1
  197. package/dist/web-extension-cjs/src/core/util/assert.d.ts +1 -0
  198. package/dist/web-extension-cjs/src/model/public_types.d.ts +7 -0
  199. package/dist/web-extension-cjs/src/platform_browser/strategies/phone.d.ts +6 -3
  200. package/dist/web-extension-cjs/src/platform_browser/strategies/popup.d.ts +4 -2
  201. package/dist/web-extension-cjs/src/platform_browser/strategies/redirect.d.ts +8 -4
  202. package/dist/web-extension-cjs/test/helpers/integration/helpers.d.ts +2 -0
  203. package/dist/web-extension-cjs/test/integration/flows/firebaseserverapp.test.d.ts +17 -0
  204. package/dist/web-extension-esm2017/index.js +2 -2
  205. package/dist/web-extension-esm2017/internal.js +58 -19
  206. package/dist/web-extension-esm2017/internal.js.map +1 -1
  207. package/dist/web-extension-esm2017/{register-7b89e556.js → register-3473374b.js} +148 -7
  208. package/dist/web-extension-esm2017/register-3473374b.js.map +1 -0
  209. package/dist/web-extension-esm2017/src/core/auth/auth_impl.d.ts +1 -0
  210. package/dist/web-extension-esm2017/src/core/index.d.ts +9 -1
  211. package/dist/web-extension-esm2017/src/core/strategies/anonymous.d.ts +3 -0
  212. package/dist/web-extension-esm2017/src/core/strategies/credential.d.ts +6 -0
  213. package/dist/web-extension-esm2017/src/core/strategies/custom_token.d.ts +3 -0
  214. package/dist/web-extension-esm2017/src/core/strategies/email_and_password.d.ts +7 -0
  215. package/dist/web-extension-esm2017/src/core/strategies/email_link.d.ts +4 -0
  216. package/dist/web-extension-esm2017/src/core/user/account_info.d.ts +3 -0
  217. package/dist/web-extension-esm2017/src/core/user/reload.d.ts +3 -1
  218. package/dist/web-extension-esm2017/src/core/user/token_manager.d.ts +1 -0
  219. package/dist/web-extension-esm2017/src/core/user/user_impl.d.ts +7 -1
  220. package/dist/web-extension-esm2017/src/core/util/assert.d.ts +1 -0
  221. package/dist/web-extension-esm2017/src/model/public_types.d.ts +7 -0
  222. package/dist/web-extension-esm2017/src/platform_browser/strategies/phone.d.ts +6 -3
  223. package/dist/web-extension-esm2017/src/platform_browser/strategies/popup.d.ts +4 -2
  224. package/dist/web-extension-esm2017/src/platform_browser/strategies/redirect.d.ts +8 -4
  225. package/dist/web-extension-esm2017/test/helpers/integration/helpers.d.ts +2 -0
  226. package/dist/web-extension-esm2017/test/integration/flows/firebaseserverapp.test.d.ts +17 -0
  227. package/package.json +7 -7
  228. package/dist/browser-cjs/index-6a907fc6.js.map +0 -1
  229. package/dist/cordova/popup_redirect-58faecee.js.map +0 -1
  230. package/dist/esm2017/index-e939beb5.js.map +0 -1
  231. package/dist/esm5/index-3bd54529.js.map +0 -1
  232. package/dist/node/totp-7d693c11.js.map +0 -1
  233. package/dist/node-esm/totp-56a8eeec.js.map +0 -1
  234. package/dist/rn/index-8ee80bdc.js.map +0 -1
  235. package/dist/web-extension-cjs/register-9438f377.js.map +0 -1
  236. package/dist/web-extension-esm2017/register-7b89e556.js.map +0 -1
@@ -1,5 +1,5 @@
1
+ import { SDK_VERSION, _isFirebaseServerApp, _getProvider, _registerComponent, registerVersion, getApp } from '@firebase/app';
1
2
  import { ErrorFactory, isBrowserExtension, isMobileCordova, isReactNative, FirebaseError, querystring, getModularInstance, base64Decode, getUA, isIE, createSubscribe, deepEqual, querystringDecode, extractQuerystring, isEmpty, getExperimentalSetting, getDefaultEmulatorHost } from '@firebase/util';
2
- import { SDK_VERSION, _getProvider, _registerComponent, registerVersion, getApp } from '@firebase/app';
3
3
  import { Logger, LogLevel } from '@firebase/logger';
4
4
  import { __rest } from 'tslib';
5
5
  import { Component } from '@firebase/component';
@@ -480,6 +480,9 @@ function _errorWithCustomMessage(auth, code, message) {
480
480
  appName: auth.name
481
481
  });
482
482
  }
483
+ function _serverAppCurrentUserOperationNotSupportedError(auth) {
484
+ return _errorWithCustomMessage(auth, "operation-not-supported-in-this-environment" /* AuthErrorCode.OPERATION_NOT_SUPPORTED */, 'Operations that alter the current user are not supported in conjunction with FirebaseServerApp');
485
+ }
483
486
  function _assertInstanceOf(auth, object, instance) {
484
487
  const constructorInstance = instance;
485
488
  if (!(object instanceof constructorInstance)) {
@@ -1588,11 +1591,16 @@ class StsTokenManager {
1588
1591
  : _tokenExpiresIn(response.idToken);
1589
1592
  this.updateTokensAndExpiration(response.idToken, response.refreshToken, expiresIn);
1590
1593
  }
1594
+ updateFromIdToken(idToken) {
1595
+ _assert(idToken.length !== 0, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
1596
+ const expiresIn = _tokenExpiresIn(idToken);
1597
+ this.updateTokensAndExpiration(idToken, null, expiresIn);
1598
+ }
1591
1599
  async getToken(auth, forceRefresh = false) {
1592
- _assert(!this.accessToken || this.refreshToken, auth, "user-token-expired" /* AuthErrorCode.TOKEN_EXPIRED */);
1593
1600
  if (!forceRefresh && this.accessToken && !this.isExpired) {
1594
1601
  return this.accessToken;
1595
1602
  }
1603
+ _assert(this.refreshToken, auth, "user-token-expired" /* AuthErrorCode.TOKEN_EXPIRED */);
1596
1604
  if (this.refreshToken) {
1597
1605
  await this.refresh(auth, this.refreshToken);
1598
1606
  return this.accessToken;
@@ -1772,6 +1780,9 @@ class UserImpl {
1772
1780
  }
1773
1781
  }
1774
1782
  async delete() {
1783
+ if (_isFirebaseServerApp(this.auth.app)) {
1784
+ return Promise.reject(_serverAppCurrentUserOperationNotSupportedError(this.auth));
1785
+ }
1775
1786
  const idToken = await this.getIdToken();
1776
1787
  await _logoutIfInvalidated(this, deleteAccount(this.auth, { idToken }));
1777
1788
  this.stsTokenManager.clearRefreshToken();
@@ -1855,6 +1866,44 @@ class UserImpl {
1855
1866
  await _reloadWithoutSaving(user);
1856
1867
  return user;
1857
1868
  }
1869
+ /**
1870
+ * Initialize a User from an idToken server response
1871
+ * @param auth
1872
+ * @param idTokenResponse
1873
+ */
1874
+ static async _fromGetAccountInfoResponse(auth, response, idToken) {
1875
+ const coreAccount = response.users[0];
1876
+ _assert(coreAccount.localId !== undefined, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
1877
+ const providerData = coreAccount.providerUserInfo !== undefined
1878
+ ? extractProviderData(coreAccount.providerUserInfo)
1879
+ : [];
1880
+ const isAnonymous = !(coreAccount.email && coreAccount.passwordHash) && !(providerData === null || providerData === void 0 ? void 0 : providerData.length);
1881
+ const stsTokenManager = new StsTokenManager();
1882
+ stsTokenManager.updateFromIdToken(idToken);
1883
+ // Initialize the Firebase Auth user.
1884
+ const user = new UserImpl({
1885
+ uid: coreAccount.localId,
1886
+ auth,
1887
+ stsTokenManager,
1888
+ isAnonymous
1889
+ });
1890
+ // update the user with data from the GetAccountInfo response.
1891
+ const updates = {
1892
+ uid: coreAccount.localId,
1893
+ displayName: coreAccount.displayName || null,
1894
+ photoURL: coreAccount.photoUrl || null,
1895
+ email: coreAccount.email || null,
1896
+ emailVerified: coreAccount.emailVerified || false,
1897
+ phoneNumber: coreAccount.phoneNumber || null,
1898
+ tenantId: coreAccount.tenantId || null,
1899
+ providerData,
1900
+ metadata: new UserMetadata(coreAccount.createdAt, coreAccount.lastLoginAt),
1901
+ isAnonymous: !(coreAccount.email && coreAccount.passwordHash) &&
1902
+ !(providerData === null || providerData === void 0 ? void 0 : providerData.length)
1903
+ };
1904
+ Object.assign(user, updates);
1905
+ return user;
1906
+ }
1858
1907
  }
1859
1908
 
1860
1909
  /**
@@ -2598,8 +2647,32 @@ class AuthImpl {
2598
2647
  // Skip blocking callbacks, they should not apply to a change in another tab.
2599
2648
  await this._updateCurrentUser(user, /* skipBeforeStateCallbacks */ true);
2600
2649
  }
2650
+ async initializeCurrentUserFromIdToken(idToken) {
2651
+ try {
2652
+ const response = await getAccountInfo(this, { idToken });
2653
+ const user = await UserImpl._fromGetAccountInfoResponse(this, response, idToken);
2654
+ await this.directlySetCurrentUser(user);
2655
+ }
2656
+ catch (err) {
2657
+ console.warn('FirebaseServerApp could not login user with provided authIdToken: ', err);
2658
+ await this.directlySetCurrentUser(null);
2659
+ }
2660
+ }
2601
2661
  async initializeCurrentUser(popupRedirectResolver) {
2602
2662
  var _a;
2663
+ if (_isFirebaseServerApp(this.app)) {
2664
+ const idToken = this.app.settings.authIdToken;
2665
+ if (idToken) {
2666
+ // Start the auth operation in the next tick to allow a moment for the customer's app to
2667
+ // attach an emulator, if desired.
2668
+ return new Promise(resolve => {
2669
+ setTimeout(() => this.initializeCurrentUserFromIdToken(idToken).then(resolve, resolve));
2670
+ });
2671
+ }
2672
+ else {
2673
+ return this.directlySetCurrentUser(null);
2674
+ }
2675
+ }
2603
2676
  // First check to see if we have a pending redirect event.
2604
2677
  const previouslyStoredUser = (await this.assertedPersistence.getCurrentUser());
2605
2678
  let futureCurrentUser = previouslyStoredUser;
@@ -2705,6 +2778,9 @@ class AuthImpl {
2705
2778
  this._deleted = true;
2706
2779
  }
2707
2780
  async updateCurrentUser(userExtern) {
2781
+ if (_isFirebaseServerApp(this.app)) {
2782
+ return Promise.reject(_serverAppCurrentUserOperationNotSupportedError(this));
2783
+ }
2708
2784
  // The public updateCurrentUser method needs to make a copy of the user,
2709
2785
  // and also check that the project matches
2710
2786
  const user = userExtern
@@ -2731,6 +2807,9 @@ class AuthImpl {
2731
2807
  });
2732
2808
  }
2733
2809
  async signOut() {
2810
+ if (_isFirebaseServerApp(this.app)) {
2811
+ return Promise.reject(_serverAppCurrentUserOperationNotSupportedError(this));
2812
+ }
2734
2813
  // Run first, to block _setRedirectUser() if any callbacks fail.
2735
2814
  await this.beforeStateQueue.runMiddleware(null);
2736
2815
  // Clear the redirect user when signOut is called
@@ -2742,6 +2821,9 @@ class AuthImpl {
2742
2821
  return this._updateCurrentUser(null, /* skipBeforeStateCallbacks */ true);
2743
2822
  }
2744
2823
  setPersistence(persistence) {
2824
+ if (_isFirebaseServerApp(this.app)) {
2825
+ return Promise.reject(_serverAppCurrentUserOperationNotSupportedError(this));
2826
+ }
2745
2827
  return this.queue(async () => {
2746
2828
  await this.assertedPersistence.setPersistence(_getInstance(persistence));
2747
2829
  });
@@ -5187,12 +5269,18 @@ function providerIdForResponse(response) {
5187
5269
  * If there is already an anonymous user signed in, that user will be returned; otherwise, a
5188
5270
  * new anonymous user identity will be created and returned.
5189
5271
  *
5272
+ * This method is not supported by {@link Auth} instances created with a
5273
+ * {@link @firebase/app#FirebaseServerApp}.
5274
+ *
5190
5275
  * @param auth - The {@link Auth} instance.
5191
5276
  *
5192
5277
  * @public
5193
5278
  */
5194
5279
  async function signInAnonymously(auth) {
5195
5280
  var _a;
5281
+ if (_isFirebaseServerApp(auth.app)) {
5282
+ return Promise.reject(_serverAppCurrentUserOperationNotSupportedError(auth));
5283
+ }
5196
5284
  const authInternal = _castAuth(auth);
5197
5285
  await authInternal._initializationPromise;
5198
5286
  if ((_a = authInternal.currentUser) === null || _a === void 0 ? void 0 : _a.isAnonymous) {
@@ -5353,6 +5441,9 @@ async function _assertLinkedStatus(expected, user, provider) {
5353
5441
  */
5354
5442
  async function _reauthenticate(user, credential, bypassAuthState = false) {
5355
5443
  const { auth } = user;
5444
+ if (_isFirebaseServerApp(auth.app)) {
5445
+ return Promise.reject(_serverAppCurrentUserOperationNotSupportedError(auth));
5446
+ }
5356
5447
  const operationType = "reauthenticate" /* OperationType.REAUTHENTICATE */;
5357
5448
  try {
5358
5449
  const response = await _logoutIfInvalidated(user, _processCredentialSavingMfaContextIfNecessary(auth, operationType, credential, user), bypassAuthState);
@@ -5389,6 +5480,9 @@ async function _reauthenticate(user, credential, bypassAuthState = false) {
5389
5480
  * limitations under the License.
5390
5481
  */
5391
5482
  async function _signInWithCredential(auth, credential, bypassAuthState = false) {
5483
+ if (_isFirebaseServerApp(auth.app)) {
5484
+ return Promise.reject(_serverAppCurrentUserOperationNotSupportedError(auth));
5485
+ }
5392
5486
  const operationType = "signIn" /* OperationType.SIGN_IN */;
5393
5487
  const response = await _processCredentialSavingMfaContextIfNecessary(auth, operationType, credential);
5394
5488
  const userCredential = await UserCredentialImpl._fromIdTokenResponse(auth, operationType, response);
@@ -5403,6 +5497,9 @@ async function _signInWithCredential(auth, credential, bypassAuthState = false)
5403
5497
  * @remarks
5404
5498
  * An {@link AuthProvider} can be used to generate the credential.
5405
5499
  *
5500
+ * This method is not supported by {@link Auth} instances created with a
5501
+ * {@link @firebase/app#FirebaseServerApp}.
5502
+ *
5406
5503
  * @param auth - The {@link Auth} instance.
5407
5504
  * @param credential - The auth credential.
5408
5505
  *
@@ -5435,6 +5532,9 @@ async function linkWithCredential(user, credential) {
5435
5532
  * attempts. This method can be used to recover from a `CREDENTIAL_TOO_OLD_LOGIN_AGAIN` error
5436
5533
  * or a `TOKEN_EXPIRED` error.
5437
5534
  *
5535
+ * This method is not supported on any {@link User} signed in by {@link Auth} instances
5536
+ * created with a {@link @firebase/app#FirebaseServerApp}.
5537
+ *
5438
5538
  * @param user - The user.
5439
5539
  * @param credential - The auth credential.
5440
5540
  *
@@ -5491,12 +5591,18 @@ async function signInWithCustomToken$1(auth, request) {
5491
5591
  *
5492
5592
  * Fails with an error if the token is invalid, expired, or not accepted by the Firebase Auth service.
5493
5593
  *
5594
+ * This method is not supported by {@link Auth} instances created with a
5595
+ * {@link @firebase/app#FirebaseServerApp}.
5596
+ *
5494
5597
  * @param auth - The {@link Auth} instance.
5495
5598
  * @param customToken - The custom token to sign in with.
5496
5599
  *
5497
5600
  * @public
5498
5601
  */
5499
5602
  async function signInWithCustomToken(auth, customToken) {
5603
+ if (_isFirebaseServerApp(auth.app)) {
5604
+ return Promise.reject(_serverAppCurrentUserOperationNotSupportedError(auth));
5605
+ }
5500
5606
  const authInternal = _castAuth(auth);
5501
5607
  const response = await signInWithCustomToken$1(authInternal, {
5502
5608
  token: customToken,
@@ -5784,6 +5890,9 @@ async function verifyPasswordResetCode(auth, code) {
5784
5890
  *
5785
5891
  * User account creation can fail if the account already exists or the password is invalid.
5786
5892
  *
5893
+ * This method is not supported on {@link Auth} instances created with a
5894
+ * {@link @firebase/app#FirebaseServerApp}.
5895
+ *
5787
5896
  * Note: The email address acts as a unique identifier for the user and enables an email-based
5788
5897
  * password reset. This function will create a new user account and set the initial user password.
5789
5898
  *
@@ -5794,6 +5903,9 @@ async function verifyPasswordResetCode(auth, code) {
5794
5903
  * @public
5795
5904
  */
5796
5905
  async function createUserWithEmailAndPassword(auth, email, password) {
5906
+ if (_isFirebaseServerApp(auth.app)) {
5907
+ return Promise.reject(_serverAppCurrentUserOperationNotSupportedError(auth));
5908
+ }
5797
5909
  const authInternal = _castAuth(auth);
5798
5910
  const request = {
5799
5911
  returnSecureToken: true,
@@ -5820,10 +5932,14 @@ async function createUserWithEmailAndPassword(auth, email, password) {
5820
5932
  * When [Email Enumeration Protection](https://cloud.google.com/identity-platform/docs/admin/email-enumeration-protection) is enabled,
5821
5933
  * this method fails with "auth/invalid-credential" in case of an invalid email/password.
5822
5934
  *
5935
+ * This method is not supported on {@link Auth} instances created with a
5936
+ * {@link @firebase/app#FirebaseServerApp}.
5937
+ *
5823
5938
  * Note: The user's password is NOT the password used to access the user's email account. The
5824
5939
  * email address serves as a unique identifier for the user, and the password is used to access
5825
5940
  * the user's account in your Firebase project. See also: {@link createUserWithEmailAndPassword}.
5826
5941
  *
5942
+ *
5827
5943
  * @param auth - The {@link Auth} instance.
5828
5944
  * @param email - The users email address.
5829
5945
  * @param password - The users password.
@@ -5831,6 +5947,9 @@ async function createUserWithEmailAndPassword(auth, email, password) {
5831
5947
  * @public
5832
5948
  */
5833
5949
  function signInWithEmailAndPassword(auth, email, password) {
5950
+ if (_isFirebaseServerApp(auth.app)) {
5951
+ return Promise.reject(_serverAppCurrentUserOperationNotSupportedError(auth));
5952
+ }
5834
5953
  return signInWithCredential(getModularInstance(auth), EmailAuthProvider.credential(email, password)).catch(async (error) => {
5835
5954
  if (error.code === `auth/${"password-does-not-meet-requirements" /* AuthErrorCode.PASSWORD_DOES_NOT_MEET_REQUIREMENTS */}`) {
5836
5955
  void recachePasswordPolicy(auth);
@@ -5929,6 +6048,9 @@ function isSignInWithEmailLink(auth, emailLink) {
5929
6048
  *
5930
6049
  * Fails with an error if the email address is invalid or OTP in email link expires.
5931
6050
  *
6051
+ * This method is not supported by {@link Auth} instances created with a
6052
+ * {@link @firebase/app#FirebaseServerApp}.
6053
+ *
5932
6054
  * Note: Confirm the link is a sign-in email link before calling this method firebase.auth.Auth.isSignInWithEmailLink.
5933
6055
  *
5934
6056
  * @example
@@ -5952,6 +6074,7 @@ function isSignInWithEmailLink(auth, emailLink) {
5952
6074
  * }
5953
6075
  * ```
5954
6076
  *
6077
+ *
5955
6078
  * @param auth - The {@link Auth} instance.
5956
6079
  * @param email - The user's email address.
5957
6080
  * @param emailLink - The link sent to the user's email address.
@@ -5959,6 +6082,9 @@ function isSignInWithEmailLink(auth, emailLink) {
5959
6082
  * @public
5960
6083
  */
5961
6084
  async function signInWithEmailLink(auth, email, emailLink) {
6085
+ if (_isFirebaseServerApp(auth.app)) {
6086
+ return Promise.reject(_serverAppCurrentUserOperationNotSupportedError(auth));
6087
+ }
5962
6088
  const authModular = getModularInstance(auth);
5963
6089
  const credential = EmailAuthProvider.credentialWithLink(email, emailLink || _getCurrentUrl());
5964
6090
  // Check if the tenant ID in the email link matches the tenant ID on Auth
@@ -6205,6 +6331,9 @@ async function updateProfile(user, { displayName, photoURL: photoUrl }) {
6205
6331
  * An email will be sent to the original email address (if it was set) that allows to revoke the
6206
6332
  * email address change, in order to protect them from account hijacking.
6207
6333
  *
6334
+ * This method is not supported on any {@link User} signed in by {@link Auth} instances
6335
+ * created with a {@link @firebase/app#FirebaseServerApp}.
6336
+ *
6208
6337
  * Important: this is a security sensitive operation that requires the user to have recently signed
6209
6338
  * in. If this requirement isn't met, ask the user to authenticate again and then call
6210
6339
  * {@link reauthenticateWithCredential}.
@@ -6218,7 +6347,11 @@ async function updateProfile(user, { displayName, photoURL: photoUrl }) {
6218
6347
  * @public
6219
6348
  */
6220
6349
  function updateEmail(user, newEmail) {
6221
- return updateEmailOrPassword(getModularInstance(user), newEmail, null);
6350
+ const userInternal = getModularInstance(user);
6351
+ if (_isFirebaseServerApp(userInternal.auth.app)) {
6352
+ return Promise.reject(_serverAppCurrentUserOperationNotSupportedError(userInternal.auth));
6353
+ }
6354
+ return updateEmailOrPassword(userInternal, newEmail, null);
6222
6355
  }
6223
6356
  /**
6224
6357
  * Updates the user's password.
@@ -6395,7 +6528,8 @@ function getAdditionalUserInfo(userCredential) {
6395
6528
  * remembered or not. It also makes it easier to never persist the `Auth` state for applications
6396
6529
  * that are shared by other users or have sensitive data.
6397
6530
  *
6398
- * This method does not work in a Node.js environment.
6531
+ * This method does not work in a Node.js environment or with {@link Auth} instances created with a
6532
+ * {@link @firebase/app#FirebaseServerApp}.
6399
6533
  *
6400
6534
  * @example
6401
6535
  * ```javascript
@@ -6541,6 +6675,9 @@ function useDeviceLanguage(auth) {
6541
6675
  * The operation fails with an error if the user to be updated belongs to a different Firebase
6542
6676
  * project.
6543
6677
  *
6678
+ * This method is not supported by {@link Auth} instances created with a
6679
+ * {@link @firebase/app#FirebaseServerApp}.
6680
+ *
6544
6681
  * @param auth - The {@link Auth} instance.
6545
6682
  * @param user - The new {@link User}.
6546
6683
  *
@@ -6552,6 +6689,10 @@ function updateCurrentUser(auth, user) {
6552
6689
  /**
6553
6690
  * Signs out the current user.
6554
6691
  *
6692
+ * @remarks
6693
+ * This method is not supported by {@link Auth} instances created with a
6694
+ * {@link @firebase/app#FirebaseServerApp}.
6695
+ *
6555
6696
  * @param auth - The {@link Auth} instance.
6556
6697
  *
6557
6698
  * @public
@@ -8331,7 +8472,8 @@ class ConfirmationResultImpl {
8331
8472
  * {@link RecaptchaVerifier} (like React Native), but you need to use a
8332
8473
  * third-party {@link ApplicationVerifier} implementation.
8333
8474
  *
8334
- * This method does not work in a Node.js environment.
8475
+ * This method does not work in a Node.js environment or with {@link Auth} instances created with a
8476
+ * {@link @firebase/app#FirebaseServerApp}.
8335
8477
  *
8336
8478
  * @example
8337
8479
  * ```javascript
@@ -8349,6 +8491,9 @@ class ConfirmationResultImpl {
8349
8491
  * @public
8350
8492
  */
8351
8493
  async function signInWithPhoneNumber(auth, phoneNumber, appVerifier) {
8494
+ if (_isFirebaseServerApp(auth.app)) {
8495
+ return Promise.reject(_serverAppCurrentUserOperationNotSupportedError(auth));
8496
+ }
8352
8497
  const authInternal = _castAuth(auth);
8353
8498
  const verificationId = await _verifyPhoneNumber(authInternal, phoneNumber, getModularInstance(appVerifier));
8354
8499
  return new ConfirmationResultImpl(verificationId, cred => signInWithCredential(authInternal, cred));
@@ -8377,7 +8522,8 @@ async function linkWithPhoneNumber(user, phoneNumber, appVerifier) {
8377
8522
  * @remarks
8378
8523
  * Use before operations such as {@link updatePassword} that require tokens from recent sign-in attempts.
8379
8524
  *
8380
- * This method does not work in a Node.js environment.
8525
+ * This method does not work in a Node.js environment or on any {@link User} signed in by
8526
+ * {@link Auth} instances created with a {@link @firebase/app#FirebaseServerApp}.
8381
8527
  *
8382
8528
  * @param user - The user.
8383
8529
  * @param phoneNumber - The user's phone number in E.164 format (e.g. +16505550101).
@@ -8387,6 +8533,9 @@ async function linkWithPhoneNumber(user, phoneNumber, appVerifier) {
8387
8533
  */
8388
8534
  async function reauthenticateWithPhoneNumber(user, phoneNumber, appVerifier) {
8389
8535
  const userInternal = getModularInstance(user);
8536
+ if (_isFirebaseServerApp(userInternal.auth.app)) {
8537
+ return Promise.reject(_serverAppCurrentUserOperationNotSupportedError(userInternal.auth));
8538
+ }
8390
8539
  const verificationId = await _verifyPhoneNumber(userInternal.auth, phoneNumber, getModularInstance(appVerifier));
8391
8540
  return new ConfirmationResultImpl(verificationId, cred => reauthenticateWithCredential(userInternal, cred));
8392
8541
  }
@@ -8453,7 +8602,8 @@ async function _verifyPhoneNumber(auth, options, verifier) {
8453
8602
  * Updates the user's phone number.
8454
8603
  *
8455
8604
  * @remarks
8456
- * This method does not work in a Node.js environment.
8605
+ * This method does not work in a Node.js environment or on any {@link User} signed in by
8606
+ * {@link Auth} instances created with a {@link @firebase/app#FirebaseServerApp}.
8457
8607
  *
8458
8608
  * @example
8459
8609
  * ```
@@ -8472,7 +8622,11 @@ async function _verifyPhoneNumber(auth, options, verifier) {
8472
8622
  * @public
8473
8623
  */
8474
8624
  async function updatePhoneNumber(user, credential) {
8475
- await _link$1(getModularInstance(user), credential);
8625
+ const userInternal = getModularInstance(user);
8626
+ if (_isFirebaseServerApp(userInternal.auth.app)) {
8627
+ return Promise.reject(_serverAppCurrentUserOperationNotSupportedError(userInternal.auth));
8628
+ }
8629
+ await _link$1(userInternal, credential);
8476
8630
  }
8477
8631
 
8478
8632
  /**
@@ -8858,7 +9012,8 @@ const _POLL_WINDOW_CLOSE_TIMEOUT = new Delay(2000, 10000);
8858
9012
  * If succeeds, returns the signed in user along with the provider's credential. If sign in was
8859
9013
  * unsuccessful, returns an error object containing additional information about the error.
8860
9014
  *
8861
- * This method does not work in a Node.js environment.
9015
+ * This method does not work in a Node.js environment or with {@link Auth} instances created with a
9016
+ * {@link @firebase/app#FirebaseServerApp}.
8862
9017
  *
8863
9018
  * @example
8864
9019
  * ```javascript
@@ -8882,6 +9037,9 @@ const _POLL_WINDOW_CLOSE_TIMEOUT = new Delay(2000, 10000);
8882
9037
  * @public
8883
9038
  */
8884
9039
  async function signInWithPopup(auth, provider, resolver) {
9040
+ if (_isFirebaseServerApp(auth.app)) {
9041
+ return Promise.reject(_createError(auth, "operation-not-supported-in-this-environment" /* AuthErrorCode.OPERATION_NOT_SUPPORTED */));
9042
+ }
8885
9043
  const authInternal = _castAuth(auth);
8886
9044
  _assertInstanceOf(auth, provider, FederatedAuthProvider);
8887
9045
  const resolverInternal = _withDefaultResolver(authInternal, resolver);
@@ -8896,7 +9054,8 @@ async function signInWithPopup(auth, provider, resolver) {
8896
9054
  * If the reauthentication is successful, the returned result will contain the user and the
8897
9055
  * provider's credential.
8898
9056
  *
8899
- * This method does not work in a Node.js environment.
9057
+ * This method does not work in a Node.js environment or on any {@link User} signed in by
9058
+ * {@link Auth} instances created with a {@link @firebase/app#FirebaseServerApp}.
8900
9059
  *
8901
9060
  * @example
8902
9061
  * ```javascript
@@ -8917,6 +9076,9 @@ async function signInWithPopup(auth, provider, resolver) {
8917
9076
  */
8918
9077
  async function reauthenticateWithPopup(user, provider, resolver) {
8919
9078
  const userInternal = getModularInstance(user);
9079
+ if (_isFirebaseServerApp(userInternal.auth.app)) {
9080
+ return Promise.reject(_createError(userInternal.auth, "operation-not-supported-in-this-environment" /* AuthErrorCode.OPERATION_NOT_SUPPORTED */));
9081
+ }
8920
9082
  _assertInstanceOf(userInternal.auth, provider, FederatedAuthProvider);
8921
9083
  const resolverInternal = _withDefaultResolver(userInternal.auth, resolver);
8922
9084
  const action = new PopupOperation(userInternal.auth, "reauthViaPopup" /* AuthEventType.REAUTH_VIA_POPUP */, provider, resolverInternal, userInternal);
@@ -9168,7 +9330,8 @@ function pendingRedirectKey(auth) {
9168
9330
  * Follow the {@link https://firebase.google.com/docs/auth/web/redirect-best-practices
9169
9331
  * | best practices} when using {@link signInWithRedirect}.
9170
9332
  *
9171
- * This method does not work in a Node.js environment.
9333
+ * This method does not work in a Node.js environment or with {@link Auth} instances created with a
9334
+ * {@link @firebase/app#FirebaseServerApp}.
9172
9335
  *
9173
9336
  * @example
9174
9337
  * ```javascript
@@ -9207,6 +9370,9 @@ function signInWithRedirect(auth, provider, resolver) {
9207
9370
  return _signInWithRedirect(auth, provider, resolver);
9208
9371
  }
9209
9372
  async function _signInWithRedirect(auth, provider, resolver) {
9373
+ if (_isFirebaseServerApp(auth.app)) {
9374
+ return Promise.reject(_serverAppCurrentUserOperationNotSupportedError(auth));
9375
+ }
9210
9376
  const authInternal = _castAuth(auth);
9211
9377
  _assertInstanceOf(auth, provider, FederatedAuthProvider);
9212
9378
  // Wait for auth initialization to complete, this will process pending redirects and clear the
@@ -9224,7 +9390,8 @@ async function _signInWithRedirect(auth, provider, resolver) {
9224
9390
  * Follow the {@link https://firebase.google.com/docs/auth/web/redirect-best-practices
9225
9391
  * | best practices} when using {@link reauthenticateWithRedirect}.
9226
9392
  *
9227
- * This method does not work in a Node.js environment.
9393
+ * This method does not work in a Node.js environment or with {@link Auth} instances
9394
+ * created with a {@link @firebase/app#FirebaseServerApp}.
9228
9395
  *
9229
9396
  * @example
9230
9397
  * ```javascript
@@ -9257,6 +9424,9 @@ function reauthenticateWithRedirect(user, provider, resolver) {
9257
9424
  async function _reauthenticateWithRedirect(user, provider, resolver) {
9258
9425
  const userInternal = getModularInstance(user);
9259
9426
  _assertInstanceOf(userInternal.auth, provider, FederatedAuthProvider);
9427
+ if (_isFirebaseServerApp(userInternal.auth.app)) {
9428
+ return Promise.reject(_serverAppCurrentUserOperationNotSupportedError(userInternal.auth));
9429
+ }
9260
9430
  // Wait for auth initialization to complete, this will process pending redirects and clear the
9261
9431
  // PENDING_REDIRECT_KEY in persistence. This should be completed before starting a new
9262
9432
  // redirect and creating a PENDING_REDIRECT_KEY entry.
@@ -9274,7 +9444,8 @@ async function _reauthenticateWithRedirect(user, provider, resolver) {
9274
9444
  * Follow the {@link https://firebase.google.com/docs/auth/web/redirect-best-practices
9275
9445
  * | best practices} when using {@link linkWithRedirect}.
9276
9446
  *
9277
- * This method does not work in a Node.js environment.
9447
+ * This method does not work in a Node.js environment or with {@link Auth} instances
9448
+ * created with a {@link @firebase/app#FirebaseServerApp}.
9278
9449
  *
9279
9450
  * @example
9280
9451
  * ```javascript
@@ -9321,7 +9492,8 @@ async function _linkWithRedirect(user, provider, resolver) {
9321
9492
  * If sign-in succeeded, returns the signed in user. If sign-in was unsuccessful, fails with an
9322
9493
  * error. If no redirect operation was called, returns `null`.
9323
9494
  *
9324
- * This method does not work in a Node.js environment.
9495
+ * This method does not work in a Node.js environment or with {@link Auth} instances created with a
9496
+ * {@link @firebase/app#FirebaseServerApp}.
9325
9497
  *
9326
9498
  * @example
9327
9499
  * ```javascript
@@ -9359,6 +9531,9 @@ async function getRedirectResult(auth, resolver) {
9359
9531
  return _getRedirectResult(auth, resolver, false);
9360
9532
  }
9361
9533
  async function _getRedirectResult(auth, resolverExtern, bypassAuthState = false) {
9534
+ if (_isFirebaseServerApp(auth.app)) {
9535
+ return Promise.reject(_serverAppCurrentUserOperationNotSupportedError(auth));
9536
+ }
9362
9537
  const authInternal = _castAuth(auth);
9363
9538
  const resolver = _withDefaultResolver(authInternal, resolverExtern);
9364
9539
  const action = new RedirectAction(authInternal, resolver, bypassAuthState);
@@ -10287,7 +10462,7 @@ function _isEmptyString(input) {
10287
10462
  }
10288
10463
 
10289
10464
  var name = "@firebase/auth";
10290
- var version = "1.6.2";
10465
+ var version = "1.7.0-canary.42fcdfe4c";
10291
10466
 
10292
10467
  /**
10293
10468
  * @license
@@ -10496,12 +10671,17 @@ function getAuth(app = getApp()) {
10496
10671
  ]
10497
10672
  });
10498
10673
  const authTokenSyncPath = getExperimentalSetting('authTokenSyncURL');
10499
- // Don't allow urls (XSS possibility), only paths on the same domain
10500
- // (starting with a single '/')
10501
- if (authTokenSyncPath && authTokenSyncPath.match(/^\/[^\/].*/)) {
10502
- const mintCookie = mintCookieFactory(authTokenSyncPath);
10503
- beforeAuthStateChanged(auth, mintCookie, () => mintCookie(auth.currentUser));
10504
- onIdTokenChanged(auth, user => mintCookie(user));
10674
+ // Only do the Cookie exchange in a secure context
10675
+ if (authTokenSyncPath &&
10676
+ typeof isSecureContext === 'boolean' &&
10677
+ isSecureContext) {
10678
+ // Don't allow urls (XSS possibility), only paths on the same domain
10679
+ const authTokenSyncUrl = new URL(authTokenSyncPath, location.origin);
10680
+ if (location.origin === authTokenSyncUrl.origin) {
10681
+ const mintCookie = mintCookieFactory(authTokenSyncUrl.toString());
10682
+ beforeAuthStateChanged(auth, mintCookie, () => mintCookie(auth.currentUser));
10683
+ onIdTokenChanged(auth, user => mintCookie(user));
10684
+ }
10505
10685
  }
10506
10686
  const authEmulatorHost = getDefaultEmulatorHost('auth');
10507
10687
  if (authEmulatorHost) {
@@ -10537,4 +10717,4 @@ _setExternalJSProvider({
10537
10717
  registerAuth("Browser" /* ClientPlatform.BROWSER */);
10538
10718
 
10539
10719
  export { TwitterAuthProvider as $, ActionCodeOperation as A, updateCurrentUser as B, signOut as C, revokeAccessToken as D, deleteUser as E, FactorId as F, debugErrorMap as G, prodErrorMap as H, AUTH_ERROR_CODES_MAP_DO_NOT_USE_INTERNALLY as I, initializeAuth as J, connectAuthEmulator as K, AuthCredential as L, EmailAuthCredential as M, OAuthCredential as N, OperationType as O, PhoneAuthProvider as P, PhoneAuthCredential as Q, RecaptchaVerifier as R, SignInMethod as S, TotpMultiFactorGenerator as T, inMemoryPersistence as U, EmailAuthProvider as V, FacebookAuthProvider as W, GoogleAuthProvider as X, GithubAuthProvider as Y, OAuthProvider as Z, SAMLAuthProvider as _, browserSessionPersistence as a, signInAnonymously as a0, signInWithCredential as a1, linkWithCredential as a2, reauthenticateWithCredential as a3, signInWithCustomToken as a4, sendPasswordResetEmail as a5, confirmPasswordReset as a6, applyActionCode as a7, checkActionCode as a8, verifyPasswordResetCode as a9, _isIOS7Or8 as aA, _createError as aB, _assert as aC, AuthEventManager as aD, _getInstance as aE, _persistenceKeyName as aF, _getRedirectResult as aG, _overrideRedirectResult as aH, _clearRedirectOutcomes as aI, _castAuth as aJ, UserImpl as aK, AuthImpl as aL, _getClientVersion as aM, _generateEventId as aN, AuthPopup as aO, FetchProvider as aP, SAMLAuthCredential as aQ, createUserWithEmailAndPassword as aa, signInWithEmailAndPassword as ab, sendSignInLinkToEmail as ac, isSignInWithEmailLink as ad, signInWithEmailLink as ae, fetchSignInMethodsForEmail as af, sendEmailVerification as ag, verifyBeforeUpdateEmail as ah, ActionCodeURL as ai, parseActionCodeURL as aj, updateProfile as ak, updateEmail as al, updatePassword as am, getIdToken as an, getIdTokenResult as ao, unlink as ap, getAdditionalUserInfo as aq, reload as ar, getMultiFactorResolver as as, multiFactor as at, debugAssert as au, _isIOS as av, _isAndroid as aw, _fail as ax, _getRedirectUrl as ay, _getProjectConfig as az, browserLocalPersistence as b, signInWithPopup as c, linkWithPopup as d, reauthenticateWithPopup as e, signInWithRedirect as f, linkWithRedirect as g, reauthenticateWithRedirect as h, indexedDBLocalPersistence as i, getRedirectResult as j, browserPopupRedirectResolver as k, linkWithPhoneNumber as l, PhoneMultiFactorGenerator as m, TotpSecret as n, getAuth as o, ProviderId as p, setPersistence as q, reauthenticateWithPhoneNumber as r, signInWithPhoneNumber as s, initializeRecaptchaConfig as t, updatePhoneNumber as u, validatePassword as v, onIdTokenChanged as w, beforeAuthStateChanged as x, onAuthStateChanged as y, useDeviceLanguage as z };
10540
- //# sourceMappingURL=index-e939beb5.js.map
10720
+ //# sourceMappingURL=index-3ad9a9b9.js.map