@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,4 +1,4 @@
1
- import { SDK_VERSION, _getProvider, _registerComponent, registerVersion, getApp } from '@firebase/app';
1
+ import { SDK_VERSION, _getProvider, _isFirebaseServerApp, _registerComponent, registerVersion, getApp } from '@firebase/app';
2
2
  import { ErrorFactory, deepEqual, getUA, isBrowserExtension, isMobileCordova, isReactNative, FirebaseError, querystring, getModularInstance, base64Decode, createSubscribe, querystringDecode, extractQuerystring } from '@firebase/util';
3
3
  import { __spreadArray, __assign, __awaiter, __generator, __rest, __extends } from 'tslib';
4
4
  import { Logger, LogLevel } from '@firebase/logger';
@@ -400,6 +400,9 @@ function _errorWithCustomMessage(auth, code, message) {
400
400
  appName: auth.name
401
401
  });
402
402
  }
403
+ function _serverAppCurrentUserOperationNotSupportedError(auth) {
404
+ 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');
405
+ }
403
406
  function createErrorInternal(authOrCode) {
404
407
  var _a;
405
408
  var rest = [];
@@ -552,7 +555,7 @@ function _initializeAuthInstance(auth, deps) {
552
555
  }
553
556
 
554
557
  var name = "@firebase/auth";
555
- var version = "1.6.2";
558
+ var version = "1.7.0-canary.42fcdfe4c";
556
559
 
557
560
  /**
558
561
  * @license
@@ -1812,16 +1815,21 @@ var StsTokenManager = /** @class */ (function () {
1812
1815
  : _tokenExpiresIn(response.idToken);
1813
1816
  this.updateTokensAndExpiration(response.idToken, response.refreshToken, expiresIn);
1814
1817
  };
1818
+ StsTokenManager.prototype.updateFromIdToken = function (idToken) {
1819
+ _assert(idToken.length !== 0, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
1820
+ var expiresIn = _tokenExpiresIn(idToken);
1821
+ this.updateTokensAndExpiration(idToken, null, expiresIn);
1822
+ };
1815
1823
  StsTokenManager.prototype.getToken = function (auth, forceRefresh) {
1816
1824
  if (forceRefresh === void 0) { forceRefresh = false; }
1817
1825
  return __awaiter(this, void 0, void 0, function () {
1818
1826
  return __generator(this, function (_a) {
1819
1827
  switch (_a.label) {
1820
1828
  case 0:
1821
- _assert(!this.accessToken || this.refreshToken, auth, "user-token-expired" /* AuthErrorCode.TOKEN_EXPIRED */);
1822
1829
  if (!forceRefresh && this.accessToken && !this.isExpired) {
1823
1830
  return [2 /*return*/, this.accessToken];
1824
1831
  }
1832
+ _assert(this.refreshToken, auth, "user-token-expired" /* AuthErrorCode.TOKEN_EXPIRED */);
1825
1833
  if (!this.refreshToken) return [3 /*break*/, 2];
1826
1834
  return [4 /*yield*/, this.refresh(auth, this.refreshToken)];
1827
1835
  case 1:
@@ -2045,7 +2053,11 @@ var UserImpl = /** @class */ (function () {
2045
2053
  var idToken;
2046
2054
  return __generator(this, function (_a) {
2047
2055
  switch (_a.label) {
2048
- case 0: return [4 /*yield*/, this.getIdToken()];
2056
+ case 0:
2057
+ if (_isFirebaseServerApp(this.auth.app)) {
2058
+ return [2 /*return*/, Promise.reject(_serverAppCurrentUserOperationNotSupportedError(this.auth))];
2059
+ }
2060
+ return [4 /*yield*/, this.getIdToken()];
2049
2061
  case 1:
2050
2062
  idToken = _a.sent();
2051
2063
  return [4 /*yield*/, _logoutIfInvalidated(this, deleteAccount(this.auth, { idToken: idToken }))];
@@ -2150,6 +2162,47 @@ var UserImpl = /** @class */ (function () {
2150
2162
  });
2151
2163
  });
2152
2164
  };
2165
+ /**
2166
+ * Initialize a User from an idToken server response
2167
+ * @param auth
2168
+ * @param idTokenResponse
2169
+ */
2170
+ UserImpl._fromGetAccountInfoResponse = function (auth, response, idToken) {
2171
+ return __awaiter(this, void 0, void 0, function () {
2172
+ var coreAccount, providerData, isAnonymous, stsTokenManager, user, updates;
2173
+ return __generator(this, function (_a) {
2174
+ coreAccount = response.users[0];
2175
+ _assert(coreAccount.localId !== undefined, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
2176
+ providerData = coreAccount.providerUserInfo !== undefined
2177
+ ? extractProviderData(coreAccount.providerUserInfo)
2178
+ : [];
2179
+ isAnonymous = !(coreAccount.email && coreAccount.passwordHash) && !(providerData === null || providerData === void 0 ? void 0 : providerData.length);
2180
+ stsTokenManager = new StsTokenManager();
2181
+ stsTokenManager.updateFromIdToken(idToken);
2182
+ user = new UserImpl({
2183
+ uid: coreAccount.localId,
2184
+ auth: auth,
2185
+ stsTokenManager: stsTokenManager,
2186
+ isAnonymous: isAnonymous
2187
+ });
2188
+ updates = {
2189
+ uid: coreAccount.localId,
2190
+ displayName: coreAccount.displayName || null,
2191
+ photoURL: coreAccount.photoUrl || null,
2192
+ email: coreAccount.email || null,
2193
+ emailVerified: coreAccount.emailVerified || false,
2194
+ phoneNumber: coreAccount.phoneNumber || null,
2195
+ tenantId: coreAccount.tenantId || null,
2196
+ providerData: providerData,
2197
+ metadata: new UserMetadata(coreAccount.createdAt, coreAccount.lastLoginAt),
2198
+ isAnonymous: !(coreAccount.email && coreAccount.passwordHash) &&
2199
+ !(providerData === null || providerData === void 0 ? void 0 : providerData.length)
2200
+ };
2201
+ Object.assign(user, updates);
2202
+ return [2 /*return*/, user];
2203
+ });
2204
+ });
2205
+ };
2153
2206
  return UserImpl;
2154
2207
  }());
2155
2208
 
@@ -2840,13 +2893,59 @@ var AuthImpl = /** @class */ (function () {
2840
2893
  });
2841
2894
  });
2842
2895
  };
2896
+ AuthImpl.prototype.initializeCurrentUserFromIdToken = function (idToken) {
2897
+ return __awaiter(this, void 0, void 0, function () {
2898
+ var response, user, err_1;
2899
+ return __generator(this, function (_a) {
2900
+ switch (_a.label) {
2901
+ case 0:
2902
+ _a.trys.push([0, 4, , 6]);
2903
+ return [4 /*yield*/, getAccountInfo(this, { idToken: idToken })];
2904
+ case 1:
2905
+ response = _a.sent();
2906
+ return [4 /*yield*/, UserImpl._fromGetAccountInfoResponse(this, response, idToken)];
2907
+ case 2:
2908
+ user = _a.sent();
2909
+ return [4 /*yield*/, this.directlySetCurrentUser(user)];
2910
+ case 3:
2911
+ _a.sent();
2912
+ return [3 /*break*/, 6];
2913
+ case 4:
2914
+ err_1 = _a.sent();
2915
+ console.warn('FirebaseServerApp could not login user with provided authIdToken: ', err_1);
2916
+ return [4 /*yield*/, this.directlySetCurrentUser(null)];
2917
+ case 5:
2918
+ _a.sent();
2919
+ return [3 /*break*/, 6];
2920
+ case 6: return [2 /*return*/];
2921
+ }
2922
+ });
2923
+ });
2924
+ };
2843
2925
  AuthImpl.prototype.initializeCurrentUser = function (popupRedirectResolver) {
2844
2926
  var _a;
2845
2927
  return __awaiter(this, void 0, void 0, function () {
2846
- var previouslyStoredUser, futureCurrentUser, needsTocheckMiddleware, redirectUserEventId, storedUserEventId, result, e_2;
2928
+ var idToken_1, previouslyStoredUser, futureCurrentUser, needsTocheckMiddleware, redirectUserEventId, storedUserEventId, result, e_2;
2929
+ var _this = this;
2847
2930
  return __generator(this, function (_b) {
2848
2931
  switch (_b.label) {
2849
- case 0: return [4 /*yield*/, this.assertedPersistence.getCurrentUser()];
2932
+ case 0:
2933
+ if (_isFirebaseServerApp(this.app)) {
2934
+ idToken_1 = this.app.settings.authIdToken;
2935
+ if (idToken_1) {
2936
+ // Start the auth operation in the next tick to allow a moment for the customer's app to
2937
+ // attach an emulator, if desired.
2938
+ return [2 /*return*/, new Promise(function (resolve) {
2939
+ setTimeout(function () {
2940
+ return _this.initializeCurrentUserFromIdToken(idToken_1).then(resolve, resolve);
2941
+ });
2942
+ })];
2943
+ }
2944
+ else {
2945
+ return [2 /*return*/, this.directlySetCurrentUser(null)];
2946
+ }
2947
+ }
2948
+ return [4 /*yield*/, this.assertedPersistence.getCurrentUser()];
2850
2949
  case 1:
2851
2950
  previouslyStoredUser = (_b.sent());
2852
2951
  futureCurrentUser = previouslyStoredUser;
@@ -2988,6 +3087,9 @@ var AuthImpl = /** @class */ (function () {
2988
3087
  return __awaiter(this, void 0, void 0, function () {
2989
3088
  var user;
2990
3089
  return __generator(this, function (_a) {
3090
+ if (_isFirebaseServerApp(this.app)) {
3091
+ return [2 /*return*/, Promise.reject(_serverAppCurrentUserOperationNotSupportedError(this))];
3092
+ }
2991
3093
  user = userExtern
2992
3094
  ? getModularInstance(userExtern)
2993
3095
  : null;
@@ -3035,9 +3137,12 @@ var AuthImpl = /** @class */ (function () {
3035
3137
  return __awaiter(this, void 0, void 0, function () {
3036
3138
  return __generator(this, function (_a) {
3037
3139
  switch (_a.label) {
3038
- case 0:
3039
- // Run first, to block _setRedirectUser() if any callbacks fail.
3040
- return [4 /*yield*/, this.beforeStateQueue.runMiddleware(null)];
3140
+ case 0:
3141
+ if (_isFirebaseServerApp(this.app)) {
3142
+ return [2 /*return*/, Promise.reject(_serverAppCurrentUserOperationNotSupportedError(this))];
3143
+ }
3144
+ // Run first, to block _setRedirectUser() if any callbacks fail.
3145
+ return [4 /*yield*/, this.beforeStateQueue.runMiddleware(null)];
3041
3146
  case 1:
3042
3147
  // Run first, to block _setRedirectUser() if any callbacks fail.
3043
3148
  _a.sent();
@@ -3056,6 +3161,9 @@ var AuthImpl = /** @class */ (function () {
3056
3161
  };
3057
3162
  AuthImpl.prototype.setPersistence = function (persistence) {
3058
3163
  var _this = this;
3164
+ if (_isFirebaseServerApp(this.app)) {
3165
+ return Promise.reject(_serverAppCurrentUserOperationNotSupportedError(this));
3166
+ }
3059
3167
  return this.queue(function () { return __awaiter(_this, void 0, void 0, function () {
3060
3168
  return __generator(this, function (_a) {
3061
3169
  switch (_a.label) {
@@ -7021,6 +7129,9 @@ function providerIdForResponse(response) {
7021
7129
  * If there is already an anonymous user signed in, that user will be returned; otherwise, a
7022
7130
  * new anonymous user identity will be created and returned.
7023
7131
  *
7132
+ * This method is not supported by {@link Auth} instances created with a
7133
+ * {@link @firebase/app#FirebaseServerApp}.
7134
+ *
7024
7135
  * @param auth - The {@link Auth} instance.
7025
7136
  *
7026
7137
  * @public
@@ -7032,6 +7143,9 @@ function signInAnonymously(auth) {
7032
7143
  return __generator(this, function (_b) {
7033
7144
  switch (_b.label) {
7034
7145
  case 0:
7146
+ if (_isFirebaseServerApp(auth.app)) {
7147
+ return [2 /*return*/, Promise.reject(_serverAppCurrentUserOperationNotSupportedError(auth))];
7148
+ }
7035
7149
  authInternal = _castAuth(auth);
7036
7150
  return [4 /*yield*/, authInternal._initializationPromise];
7037
7151
  case 1:
@@ -7263,6 +7377,9 @@ function _reauthenticate(user, credential, bypassAuthState) {
7263
7377
  switch (_a.label) {
7264
7378
  case 0:
7265
7379
  auth = user.auth;
7380
+ if (_isFirebaseServerApp(auth.app)) {
7381
+ return [2 /*return*/, Promise.reject(_serverAppCurrentUserOperationNotSupportedError(auth))];
7382
+ }
7266
7383
  operationType = "reauthenticate" /* OperationType.REAUTHENTICATE */;
7267
7384
  _a.label = 1;
7268
7385
  case 1:
@@ -7312,6 +7429,9 @@ function _signInWithCredential(auth, credential, bypassAuthState) {
7312
7429
  return __generator(this, function (_a) {
7313
7430
  switch (_a.label) {
7314
7431
  case 0:
7432
+ if (_isFirebaseServerApp(auth.app)) {
7433
+ return [2 /*return*/, Promise.reject(_serverAppCurrentUserOperationNotSupportedError(auth))];
7434
+ }
7315
7435
  operationType = "signIn" /* OperationType.SIGN_IN */;
7316
7436
  return [4 /*yield*/, _processCredentialSavingMfaContextIfNecessary(auth, operationType, credential)];
7317
7437
  case 1:
@@ -7335,6 +7455,9 @@ function _signInWithCredential(auth, credential, bypassAuthState) {
7335
7455
  * @remarks
7336
7456
  * An {@link AuthProvider} can be used to generate the credential.
7337
7457
  *
7458
+ * This method is not supported by {@link Auth} instances created with a
7459
+ * {@link @firebase/app#FirebaseServerApp}.
7460
+ *
7338
7461
  * @param auth - The {@link Auth} instance.
7339
7462
  * @param credential - The auth credential.
7340
7463
  *
@@ -7381,6 +7504,9 @@ function linkWithCredential(user, credential) {
7381
7504
  * attempts. This method can be used to recover from a `CREDENTIAL_TOO_OLD_LOGIN_AGAIN` error
7382
7505
  * or a `TOKEN_EXPIRED` error.
7383
7506
  *
7507
+ * This method is not supported on any {@link User} signed in by {@link Auth} instances
7508
+ * created with a {@link @firebase/app#FirebaseServerApp}.
7509
+ *
7384
7510
  * @param user - The user.
7385
7511
  * @param credential - The auth credential.
7386
7512
  *
@@ -7445,6 +7571,9 @@ function signInWithCustomToken$1(auth, request) {
7445
7571
  *
7446
7572
  * Fails with an error if the token is invalid, expired, or not accepted by the Firebase Auth service.
7447
7573
  *
7574
+ * This method is not supported by {@link Auth} instances created with a
7575
+ * {@link @firebase/app#FirebaseServerApp}.
7576
+ *
7448
7577
  * @param auth - The {@link Auth} instance.
7449
7578
  * @param customToken - The custom token to sign in with.
7450
7579
  *
@@ -7456,6 +7585,9 @@ function signInWithCustomToken(auth, customToken) {
7456
7585
  return __generator(this, function (_a) {
7457
7586
  switch (_a.label) {
7458
7587
  case 0:
7588
+ if (_isFirebaseServerApp(auth.app)) {
7589
+ return [2 /*return*/, Promise.reject(_serverAppCurrentUserOperationNotSupportedError(auth))];
7590
+ }
7459
7591
  authInternal = _castAuth(auth);
7460
7592
  return [4 /*yield*/, signInWithCustomToken$1(authInternal, {
7461
7593
  token: customToken,
@@ -7812,6 +7944,9 @@ function verifyPasswordResetCode(auth, code) {
7812
7944
  *
7813
7945
  * User account creation can fail if the account already exists or the password is invalid.
7814
7946
  *
7947
+ * This method is not supported on {@link Auth} instances created with a
7948
+ * {@link @firebase/app#FirebaseServerApp}.
7949
+ *
7815
7950
  * Note: The email address acts as a unique identifier for the user and enables an email-based
7816
7951
  * password reset. This function will create a new user account and set the initial user password.
7817
7952
  *
@@ -7827,6 +7962,9 @@ function createUserWithEmailAndPassword(auth, email, password) {
7827
7962
  return __generator(this, function (_a) {
7828
7963
  switch (_a.label) {
7829
7964
  case 0:
7965
+ if (_isFirebaseServerApp(auth.app)) {
7966
+ return [2 /*return*/, Promise.reject(_serverAppCurrentUserOperationNotSupportedError(auth))];
7967
+ }
7830
7968
  authInternal = _castAuth(auth);
7831
7969
  request = {
7832
7970
  returnSecureToken: true,
@@ -7862,10 +8000,14 @@ function createUserWithEmailAndPassword(auth, email, password) {
7862
8000
  * When [Email Enumeration Protection](https://cloud.google.com/identity-platform/docs/admin/email-enumeration-protection) is enabled,
7863
8001
  * this method fails with "auth/invalid-credential" in case of an invalid email/password.
7864
8002
  *
8003
+ * This method is not supported on {@link Auth} instances created with a
8004
+ * {@link @firebase/app#FirebaseServerApp}.
8005
+ *
7865
8006
  * Note: The user's password is NOT the password used to access the user's email account. The
7866
8007
  * email address serves as a unique identifier for the user, and the password is used to access
7867
8008
  * the user's account in your Firebase project. See also: {@link createUserWithEmailAndPassword}.
7868
8009
  *
8010
+ *
7869
8011
  * @param auth - The {@link Auth} instance.
7870
8012
  * @param email - The users email address.
7871
8013
  * @param password - The users password.
@@ -7874,6 +8016,9 @@ function createUserWithEmailAndPassword(auth, email, password) {
7874
8016
  */
7875
8017
  function signInWithEmailAndPassword(auth, email, password) {
7876
8018
  var _this = this;
8019
+ if (_isFirebaseServerApp(auth.app)) {
8020
+ return Promise.reject(_serverAppCurrentUserOperationNotSupportedError(auth));
8021
+ }
7877
8022
  return signInWithCredential(getModularInstance(auth), EmailAuthProvider.credential(email, password)).catch(function (error) { return __awaiter(_this, void 0, void 0, function () {
7878
8023
  return __generator(this, function (_a) {
7879
8024
  if (error.code === "auth/".concat("password-does-not-meet-requirements" /* AuthErrorCode.PASSWORD_DOES_NOT_MEET_REQUIREMENTS */)) {
@@ -7985,6 +8130,9 @@ function isSignInWithEmailLink(auth, emailLink) {
7985
8130
  *
7986
8131
  * Fails with an error if the email address is invalid or OTP in email link expires.
7987
8132
  *
8133
+ * This method is not supported by {@link Auth} instances created with a
8134
+ * {@link @firebase/app#FirebaseServerApp}.
8135
+ *
7988
8136
  * Note: Confirm the link is a sign-in email link before calling this method firebase.auth.Auth.isSignInWithEmailLink.
7989
8137
  *
7990
8138
  * @example
@@ -8008,6 +8156,7 @@ function isSignInWithEmailLink(auth, emailLink) {
8008
8156
  * }
8009
8157
  * ```
8010
8158
  *
8159
+ *
8011
8160
  * @param auth - The {@link Auth} instance.
8012
8161
  * @param email - The user's email address.
8013
8162
  * @param emailLink - The link sent to the user's email address.
@@ -8018,6 +8167,9 @@ function signInWithEmailLink(auth, email, emailLink) {
8018
8167
  return __awaiter(this, void 0, void 0, function () {
8019
8168
  var authModular, credential;
8020
8169
  return __generator(this, function (_a) {
8170
+ if (_isFirebaseServerApp(auth.app)) {
8171
+ return [2 /*return*/, Promise.reject(_serverAppCurrentUserOperationNotSupportedError(auth))];
8172
+ }
8021
8173
  authModular = getModularInstance(auth);
8022
8174
  credential = EmailAuthProvider.credentialWithLink(email, emailLink || _getCurrentUrl());
8023
8175
  // Check if the tenant ID in the email link matches the tenant ID on Auth
@@ -8331,6 +8483,9 @@ function updateProfile(user, _a) {
8331
8483
  * An email will be sent to the original email address (if it was set) that allows to revoke the
8332
8484
  * email address change, in order to protect them from account hijacking.
8333
8485
  *
8486
+ * This method is not supported on any {@link User} signed in by {@link Auth} instances
8487
+ * created with a {@link @firebase/app#FirebaseServerApp}.
8488
+ *
8334
8489
  * Important: this is a security sensitive operation that requires the user to have recently signed
8335
8490
  * in. If this requirement isn't met, ask the user to authenticate again and then call
8336
8491
  * {@link reauthenticateWithCredential}.
@@ -8344,7 +8499,11 @@ function updateProfile(user, _a) {
8344
8499
  * @public
8345
8500
  */
8346
8501
  function updateEmail(user, newEmail) {
8347
- return updateEmailOrPassword(getModularInstance(user), newEmail, null);
8502
+ var userInternal = getModularInstance(user);
8503
+ if (_isFirebaseServerApp(userInternal.auth.app)) {
8504
+ return Promise.reject(_serverAppCurrentUserOperationNotSupportedError(userInternal.auth));
8505
+ }
8506
+ return updateEmailOrPassword(userInternal, newEmail, null);
8348
8507
  }
8349
8508
  /**
8350
8509
  * Updates the user's password.
@@ -8549,7 +8708,8 @@ function getAdditionalUserInfo(userCredential) {
8549
8708
  * remembered or not. It also makes it easier to never persist the `Auth` state for applications
8550
8709
  * that are shared by other users or have sensitive data.
8551
8710
  *
8552
- * This method does not work in a Node.js environment.
8711
+ * This method does not work in a Node.js environment or with {@link Auth} instances created with a
8712
+ * {@link @firebase/app#FirebaseServerApp}.
8553
8713
  *
8554
8714
  * @example
8555
8715
  * ```javascript
@@ -8700,6 +8860,9 @@ function useDeviceLanguage(auth) {
8700
8860
  * The operation fails with an error if the user to be updated belongs to a different Firebase
8701
8861
  * project.
8702
8862
  *
8863
+ * This method is not supported by {@link Auth} instances created with a
8864
+ * {@link @firebase/app#FirebaseServerApp}.
8865
+ *
8703
8866
  * @param auth - The {@link Auth} instance.
8704
8867
  * @param user - The new {@link User}.
8705
8868
  *
@@ -8711,6 +8874,10 @@ function updateCurrentUser(auth, user) {
8711
8874
  /**
8712
8875
  * Signs out the current user.
8713
8876
  *
8877
+ * @remarks
8878
+ * This method is not supported by {@link Auth} instances created with a
8879
+ * {@link @firebase/app#FirebaseServerApp}.
8880
+ *
8714
8881
  * @param auth - The {@link Auth} instance.
8715
8882
  *
8716
8883
  * @public