@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
@@ -68,6 +68,7 @@ export declare class AuthImpl implements AuthInternal, _FirebaseService {
68
68
  * If the persistence is changed in another window, the user manager will let us know
69
69
  */
70
70
  _onStorageEvent(): Promise<void>;
71
+ private initializeCurrentUserFromIdToken;
71
72
  private initializeCurrentUser;
72
73
  private tryRedirectSignIn;
73
74
  private reloadAndSetCurrentUserOrClear;
@@ -26,7 +26,8 @@ export { debugErrorMap, prodErrorMap, AUTH_ERROR_CODES_MAP_DO_NOT_USE_INTERNALLY
26
26
  * remembered or not. It also makes it easier to never persist the `Auth` state for applications
27
27
  * that are shared by other users or have sensitive data.
28
28
  *
29
- * This method does not work in a Node.js environment.
29
+ * This method does not work in a Node.js environment or with {@link Auth} instances created with a
30
+ * {@link @firebase/app#FirebaseServerApp}.
30
31
  *
31
32
  * @example
32
33
  * ```javascript
@@ -157,6 +158,9 @@ export declare function useDeviceLanguage(auth: Auth): void;
157
158
  * The operation fails with an error if the user to be updated belongs to a different Firebase
158
159
  * project.
159
160
  *
161
+ * This method is not supported by {@link Auth} instances created with a
162
+ * {@link @firebase/app#FirebaseServerApp}.
163
+ *
160
164
  * @param auth - The {@link Auth} instance.
161
165
  * @param user - The new {@link User}.
162
166
  *
@@ -166,6 +170,10 @@ export declare function updateCurrentUser(auth: Auth, user: User | null): Promis
166
170
  /**
167
171
  * Signs out the current user.
168
172
  *
173
+ * @remarks
174
+ * This method is not supported by {@link Auth} instances created with a
175
+ * {@link @firebase/app#FirebaseServerApp}.
176
+ *
169
177
  * @param auth - The {@link Auth} instance.
170
178
  *
171
179
  * @public
@@ -22,6 +22,9 @@ import { Auth, UserCredential } from '../../model/public_types';
22
22
  * If there is already an anonymous user signed in, that user will be returned; otherwise, a
23
23
  * new anonymous user identity will be created and returned.
24
24
  *
25
+ * This method is not supported by {@link Auth} instances created with a
26
+ * {@link @firebase/app#FirebaseServerApp}.
27
+ *
25
28
  * @param auth - The {@link Auth} instance.
26
29
  *
27
30
  * @public
@@ -24,6 +24,9 @@ export declare function _signInWithCredential(auth: AuthInternal, credential: Au
24
24
  * @remarks
25
25
  * An {@link AuthProvider} can be used to generate the credential.
26
26
  *
27
+ * This method is not supported by {@link Auth} instances created with a
28
+ * {@link @firebase/app#FirebaseServerApp}.
29
+ *
27
30
  * @param auth - The {@link Auth} instance.
28
31
  * @param credential - The auth credential.
29
32
  *
@@ -50,6 +53,9 @@ export declare function linkWithCredential(user: User, credential: AuthCredentia
50
53
  * attempts. This method can be used to recover from a `CREDENTIAL_TOO_OLD_LOGIN_AGAIN` error
51
54
  * or a `TOKEN_EXPIRED` error.
52
55
  *
56
+ * This method is not supported on any {@link User} signed in by {@link Auth} instances
57
+ * created with a {@link @firebase/app#FirebaseServerApp}.
58
+ *
53
59
  * @param user - The user.
54
60
  * @param credential - The auth credential.
55
61
  *
@@ -26,6 +26,9 @@ import { Auth, UserCredential } from '../../model/public_types';
26
26
  *
27
27
  * Fails with an error if the token is invalid, expired, or not accepted by the Firebase Auth service.
28
28
  *
29
+ * This method is not supported by {@link Auth} instances created with a
30
+ * {@link @firebase/app#FirebaseServerApp}.
31
+ *
29
32
  * @param auth - The {@link Auth} instance.
30
33
  * @param customToken - The custom token to sign in with.
31
34
  *
@@ -99,6 +99,9 @@ export declare function verifyPasswordResetCode(auth: Auth, code: string): Promi
99
99
  *
100
100
  * User account creation can fail if the account already exists or the password is invalid.
101
101
  *
102
+ * This method is not supported on {@link Auth} instances created with a
103
+ * {@link @firebase/app#FirebaseServerApp}.
104
+ *
102
105
  * Note: The email address acts as a unique identifier for the user and enables an email-based
103
106
  * password reset. This function will create a new user account and set the initial user password.
104
107
  *
@@ -117,10 +120,14 @@ export declare function createUserWithEmailAndPassword(auth: Auth, email: string
117
120
  * When [Email Enumeration Protection](https://cloud.google.com/identity-platform/docs/admin/email-enumeration-protection) is enabled,
118
121
  * this method fails with "auth/invalid-credential" in case of an invalid email/password.
119
122
  *
123
+ * This method is not supported on {@link Auth} instances created with a
124
+ * {@link @firebase/app#FirebaseServerApp}.
125
+ *
120
126
  * Note: The user's password is NOT the password used to access the user's email account. The
121
127
  * email address serves as a unique identifier for the user, and the password is used to access
122
128
  * the user's account in your Firebase project. See also: {@link createUserWithEmailAndPassword}.
123
129
  *
130
+ *
124
131
  * @param auth - The {@link Auth} instance.
125
132
  * @param email - The users email address.
126
133
  * @param password - The users password.
@@ -71,6 +71,9 @@ export declare function isSignInWithEmailLink(auth: Auth, emailLink: string): bo
71
71
  *
72
72
  * Fails with an error if the email address is invalid or OTP in email link expires.
73
73
  *
74
+ * This method is not supported by {@link Auth} instances created with a
75
+ * {@link @firebase/app#FirebaseServerApp}.
76
+ *
74
77
  * Note: Confirm the link is a sign-in email link before calling this method firebase.auth.Auth.isSignInWithEmailLink.
75
78
  *
76
79
  * @example
@@ -94,6 +97,7 @@ export declare function isSignInWithEmailLink(auth: Auth, emailLink: string): bo
94
97
  * }
95
98
  * ```
96
99
  *
100
+ *
97
101
  * @param auth - The {@link Auth} instance.
98
102
  * @param email - The user's email address.
99
103
  * @param emailLink - The link sent to the user's email address.
@@ -34,6 +34,9 @@ export declare function updateProfile(user: User, { displayName, photoURL: photo
34
34
  * An email will be sent to the original email address (if it was set) that allows to revoke the
35
35
  * email address change, in order to protect them from account hijacking.
36
36
  *
37
+ * This method is not supported on any {@link User} signed in by {@link Auth} instances
38
+ * created with a {@link @firebase/app#FirebaseServerApp}.
39
+ *
37
40
  * Important: this is a security sensitive operation that requires the user to have recently signed
38
41
  * in. If this requirement isn't met, ask the user to authenticate again and then call
39
42
  * {@link reauthenticateWithCredential}.
@@ -14,7 +14,8 @@
14
14
  * See the License for the specific language governing permissions and
15
15
  * limitations under the License.
16
16
  */
17
- import { User } from '../../model/public_types';
17
+ import { User, UserInfo } from '../../model/public_types';
18
+ import { ProviderUserInfo } from '../../api/account_management/account';
18
19
  import { UserInternal } from '../../model/user';
19
20
  export declare function _reloadWithoutSaving(user: UserInternal): Promise<void>;
20
21
  /**
@@ -25,3 +26,4 @@ export declare function _reloadWithoutSaving(user: UserInternal): Promise<void>;
25
26
  * @public
26
27
  */
27
28
  export declare function reload(user: User): Promise<void>;
29
+ export declare function extractProviderData(providers: ProviderUserInfo[]): UserInfo[];
@@ -37,6 +37,7 @@ export declare class StsTokenManager {
37
37
  expirationTime: number | null;
38
38
  get isExpired(): boolean;
39
39
  updateFromServerResponse(response: IdTokenResponse | FinalizeMfaResponse): void;
40
+ updateFromIdToken(idToken: string): void;
40
41
  getToken(auth: AuthInternal, forceRefresh?: boolean): Promise<string | null>;
41
42
  clearRefreshToken(): void;
42
43
  private refresh;
@@ -16,7 +16,7 @@
16
16
  */
17
17
  import { IdTokenResult } from '../../model/public_types';
18
18
  import { NextFn } from '@firebase/util';
19
- import { APIUserInfo } from '../../api/account_management/account';
19
+ import { APIUserInfo, GetAccountInfoResponse } from '../../api/account_management/account';
20
20
  import { FinalizeMfaResponse } from '../../api/authentication/mfa';
21
21
  import { AuthInternal } from '../../model/auth';
22
22
  import { IdTokenResponse } from '../../model/id_token';
@@ -65,4 +65,10 @@ export declare class UserImpl implements UserInternal {
65
65
  * @param idTokenResponse
66
66
  */
67
67
  static _fromIdTokenResponse(auth: AuthInternal, idTokenResponse: IdTokenResponse, isAnonymous?: boolean): Promise<UserInternal>;
68
+ /**
69
+ * Initialize a User from an idToken server response
70
+ * @param auth
71
+ * @param idTokenResponse
72
+ */
73
+ static _fromGetAccountInfoResponse(auth: AuthInternal, response: GetAccountInfoResponse, idToken: string): Promise<UserInternal>;
68
74
  }
@@ -38,6 +38,7 @@ export declare function _fail<K extends AuthErrorCode>(auth: Auth, code: K, ...d
38
38
  export declare function _createError<K extends AuthErrorCode>(code: K, ...data: {} extends AuthErrorParams[K] ? [AuthErrorParams[K]?] : [AuthErrorParams[K]]): FirebaseError;
39
39
  export declare function _createError<K extends AuthErrorCode>(auth: Auth, code: K, ...data: {} extends LessAppName<K> ? [LessAppName<K>?] : [LessAppName<K>]): FirebaseError;
40
40
  export declare function _errorWithCustomMessage(auth: Auth, code: AuthErrorCode, message: string): FirebaseError;
41
+ export declare function _serverAppCurrentUserOperationNotSupportedError(auth: Auth): FirebaseError;
41
42
  export declare function _assertInstanceOf(auth: Auth, object: object, instance: unknown): void;
42
43
  export declare function _assert<K extends AuthErrorCode>(assertion: unknown, code: K, ...data: {} extends AuthErrorParams[K] ? [AuthErrorParams[K]?] : [AuthErrorParams[K]]): asserts assertion;
43
44
  export declare function _assert<K extends AuthErrorCode>(assertion: unknown, auth: Auth, code: K, ...data: {} extends LessAppName<K> ? [LessAppName<K>?] : [LessAppName<K>]): asserts assertion;
@@ -287,6 +287,10 @@ export interface Auth {
287
287
  useDeviceLanguage(): void;
288
288
  /**
289
289
  * Signs out the current user. This does not automatically revoke the user's ID token.
290
+ *
291
+ * @remarks
292
+ * This method is not supported by {@link Auth} instances created with a
293
+ * {@link @firebase/app#FirebaseServerApp}.
290
294
  */
291
295
  signOut(): Promise<void>;
292
296
  }
@@ -943,6 +947,9 @@ export interface User extends UserInfo {
943
947
  * Important: this is a security-sensitive operation that requires the user to have recently
944
948
  * signed in. If this requirement isn't met, ask the user to authenticate again and then call
945
949
  * one of the reauthentication methods like {@link reauthenticateWithCredential}.
950
+ *
951
+ * This method is not supported on any {@link User} signed in by {@link Auth} instances
952
+ * created with a {@link @firebase/app#FirebaseServerApp}.
946
953
  */
947
954
  delete(): Promise<void>;
948
955
  /**
@@ -33,7 +33,8 @@ import { AuthInternal } from '../../model/auth';
33
33
  * {@link RecaptchaVerifier} (like React Native), but you need to use a
34
34
  * third-party {@link ApplicationVerifier} implementation.
35
35
  *
36
- * This method does not work in a Node.js environment.
36
+ * This method does not work in a Node.js environment or with {@link Auth} instances created with a
37
+ * {@link @firebase/app#FirebaseServerApp}.
37
38
  *
38
39
  * @example
39
40
  * ```javascript
@@ -70,7 +71,8 @@ export declare function linkWithPhoneNumber(user: User, phoneNumber: string, app
70
71
  * @remarks
71
72
  * Use before operations such as {@link updatePassword} that require tokens from recent sign-in attempts.
72
73
  *
73
- * This method does not work in a Node.js environment.
74
+ * This method does not work in a Node.js environment or on any {@link User} signed in by
75
+ * {@link Auth} instances created with a {@link @firebase/app#FirebaseServerApp}.
74
76
  *
75
77
  * @param user - The user.
76
78
  * @param phoneNumber - The user's phone number in E.164 format (e.g. +16505550101).
@@ -88,7 +90,8 @@ export declare function _verifyPhoneNumber(auth: AuthInternal, options: PhoneInf
88
90
  * Updates the user's phone number.
89
91
  *
90
92
  * @remarks
91
- * This method does not work in a Node.js environment.
93
+ * This method does not work in a Node.js environment or on any {@link User} signed in by
94
+ * {@link Auth} instances created with a {@link @firebase/app#FirebaseServerApp}.
92
95
  *
93
96
  * @example
94
97
  * ```
@@ -27,7 +27,8 @@ export declare const _POLL_WINDOW_CLOSE_TIMEOUT: Delay;
27
27
  * If succeeds, returns the signed in user along with the provider's credential. If sign in was
28
28
  * unsuccessful, returns an error object containing additional information about the error.
29
29
  *
30
- * This method does not work in a Node.js environment.
30
+ * This method does not work in a Node.js environment or with {@link Auth} instances created with a
31
+ * {@link @firebase/app#FirebaseServerApp}.
31
32
  *
32
33
  * @example
33
34
  * ```javascript
@@ -59,7 +60,8 @@ export declare function signInWithPopup(auth: Auth, provider: AuthProvider, reso
59
60
  * If the reauthentication is successful, the returned result will contain the user and the
60
61
  * provider's credential.
61
62
  *
62
- * This method does not work in a Node.js environment.
63
+ * This method does not work in a Node.js environment or on any {@link User} signed in by
64
+ * {@link Auth} instances created with a {@link @firebase/app#FirebaseServerApp}.
63
65
  *
64
66
  * @example
65
67
  * ```javascript
@@ -23,7 +23,8 @@ import { Auth, AuthProvider, PopupRedirectResolver, User, UserCredential } from
23
23
  * Follow the {@link https://firebase.google.com/docs/auth/web/redirect-best-practices
24
24
  * | best practices} when using {@link signInWithRedirect}.
25
25
  *
26
- * This method does not work in a Node.js environment.
26
+ * This method does not work in a Node.js environment or with {@link Auth} instances created with a
27
+ * {@link @firebase/app#FirebaseServerApp}.
27
28
  *
28
29
  * @example
29
30
  * ```javascript
@@ -67,7 +68,8 @@ export declare function _signInWithRedirect(auth: Auth, provider: AuthProvider,
67
68
  * Follow the {@link https://firebase.google.com/docs/auth/web/redirect-best-practices
68
69
  * | best practices} when using {@link reauthenticateWithRedirect}.
69
70
  *
70
- * This method does not work in a Node.js environment.
71
+ * This method does not work in a Node.js environment or with {@link Auth} instances
72
+ * created with a {@link @firebase/app#FirebaseServerApp}.
71
73
  *
72
74
  * @example
73
75
  * ```javascript
@@ -103,7 +105,8 @@ export declare function _reauthenticateWithRedirect(user: User, provider: AuthPr
103
105
  * Follow the {@link https://firebase.google.com/docs/auth/web/redirect-best-practices
104
106
  * | best practices} when using {@link linkWithRedirect}.
105
107
  *
106
- * This method does not work in a Node.js environment.
108
+ * This method does not work in a Node.js environment or with {@link Auth} instances
109
+ * created with a {@link @firebase/app#FirebaseServerApp}.
107
110
  *
108
111
  * @example
109
112
  * ```javascript
@@ -135,7 +138,8 @@ export declare function _linkWithRedirect(user: User, provider: AuthProvider, re
135
138
  * If sign-in succeeded, returns the signed in user. If sign-in was unsuccessful, fails with an
136
139
  * error. If no redirect operation was called, returns `null`.
137
140
  *
138
- * This method does not work in a Node.js environment.
141
+ * This method does not work in a Node.js environment or with {@link Auth} instances created with a
142
+ * {@link @firebase/app#FirebaseServerApp}.
139
143
  *
140
144
  * @example
141
145
  * ```javascript
@@ -14,9 +14,11 @@
14
14
  * See the License for the specific language governing permissions and
15
15
  * limitations under the License.
16
16
  */
17
+ import { FirebaseServerApp } from '@firebase/app';
17
18
  import { Auth } from '@firebase/auth';
18
19
  export declare function randomEmail(): string;
19
20
  export declare function getTestInstance(requireEmulator?: boolean): Auth;
21
+ export declare function getTestInstanceForServerApp(serverApp: FirebaseServerApp): Auth;
20
22
  export declare function cleanUpTestInstance(auth: Auth): Promise<void>;
21
23
  export declare function getTotpCode(sharedSecretKey: string, periodSec: number, verificationCodeLength: number, timestamp: Date): string;
22
24
  export declare const email = "totpuser-donotdelete@test.com";
@@ -0,0 +1,17 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2024 Google LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ export {};
@@ -1,5 +1,5 @@
1
- import { r as registerAuth, i as initializeAuth, a as indexedDBLocalPersistence, c as connectAuthEmulator } from './register-7b89e556.js';
2
- export { Y as ActionCodeURL, m as AuthCredential, A as AuthErrorCodes, E as EmailAuthCredential, q as EmailAuthProvider, F as FacebookAuthProvider, t as GithubAuthProvider, G as GoogleAuthProvider, O as OAuthCredential, w as OAuthProvider, P as PhoneAuthCredential, S as SAMLAuthProvider, T as TotpMultiFactorGenerator, b as TotpSecret, x as TwitterAuthProvider, J as applyActionCode, e as beforeAuthStateChanged, K as checkActionCode, I as confirmPasswordReset, c as connectAuthEmulator, M as createUserWithEmailAndPassword, l as debugErrorMap, k as deleteUser, V as fetchSignInMethodsForEmail, a4 as getAdditionalUserInfo, a1 as getIdToken, a2 as getIdTokenResult, a6 as getMultiFactorResolver, n as inMemoryPersistence, a as indexedDBLocalPersistence, i as initializeAuth, d as initializeRecaptchaConfig, R as isSignInWithEmailLink, B as linkWithCredential, a7 as multiFactor, f as onAuthStateChanged, o as onIdTokenChanged, Z as parseActionCodeURL, p as prodErrorMap, C as reauthenticateWithCredential, a5 as reload, j as revokeAccessToken, W as sendEmailVerification, H as sendPasswordResetEmail, Q as sendSignInLinkToEmail, s as setPersistence, y as signInAnonymously, z as signInWithCredential, D as signInWithCustomToken, N as signInWithEmailAndPassword, U as signInWithEmailLink, h as signOut, a3 as unlink, g as updateCurrentUser, $ as updateEmail, a0 as updatePassword, _ as updateProfile, u as useDeviceLanguage, v as validatePassword, X as verifyBeforeUpdateEmail, L as verifyPasswordResetCode } from './register-7b89e556.js';
1
+ import { r as registerAuth, i as initializeAuth, a as indexedDBLocalPersistence, c as connectAuthEmulator } from './register-3473374b.js';
2
+ export { Y as ActionCodeURL, m as AuthCredential, A as AuthErrorCodes, E as EmailAuthCredential, q as EmailAuthProvider, F as FacebookAuthProvider, t as GithubAuthProvider, G as GoogleAuthProvider, O as OAuthCredential, w as OAuthProvider, P as PhoneAuthCredential, S as SAMLAuthProvider, T as TotpMultiFactorGenerator, b as TotpSecret, x as TwitterAuthProvider, J as applyActionCode, e as beforeAuthStateChanged, K as checkActionCode, I as confirmPasswordReset, c as connectAuthEmulator, M as createUserWithEmailAndPassword, l as debugErrorMap, k as deleteUser, V as fetchSignInMethodsForEmail, a4 as getAdditionalUserInfo, a1 as getIdToken, a2 as getIdTokenResult, a6 as getMultiFactorResolver, n as inMemoryPersistence, a as indexedDBLocalPersistence, i as initializeAuth, d as initializeRecaptchaConfig, R as isSignInWithEmailLink, B as linkWithCredential, a7 as multiFactor, f as onAuthStateChanged, o as onIdTokenChanged, Z as parseActionCodeURL, p as prodErrorMap, C as reauthenticateWithCredential, a5 as reload, j as revokeAccessToken, W as sendEmailVerification, H as sendPasswordResetEmail, Q as sendSignInLinkToEmail, s as setPersistence, y as signInAnonymously, z as signInWithCredential, D as signInWithCustomToken, N as signInWithEmailAndPassword, U as signInWithEmailLink, h as signOut, a3 as unlink, g as updateCurrentUser, $ as updateEmail, a0 as updatePassword, _ as updateProfile, u as useDeviceLanguage, v as validatePassword, X as verifyBeforeUpdateEmail, L as verifyPasswordResetCode } from './register-3473374b.js';
3
3
  import { _getProvider, getApp } from '@firebase/app';
4
4
  import { getDefaultEmulatorHost } from '@firebase/util';
5
5
  import 'tslib';
@@ -1,8 +1,8 @@
1
- import { a8 as STORAGE_AVAILABLE_KEY, a9 as _isIframe, aa as _isMobileBrowser, ab as _isIE10, ac as _isSafari, ad as _isIOS, ae as _assert, af as Delay, ag as _window, ah as isV2, ai as _createError, aj as _recaptchaV2ScriptUrl, ak as _loadJS, al as _generateCallbackName, am as _castAuth, an as _isHttpOrHttps, ao as _isWorker, ap as getRecaptchaParams, z as signInWithCredential, aq as _assertLinkedStatus, B as linkWithCredential, C as reauthenticateWithCredential, ar as startEnrollPhoneMfa, as as startSignInPhoneMfa, at as sendPhoneVerificationCode, au as _link$1, P as PhoneAuthCredential, av as _getInstance, aw as _signInWithCredential, ax as _reauthenticate, m as AuthCredential, ay as signInWithIdp, az as _fail, aA as debugAssert, aB as _assertInstanceOf, aC as _generateEventId, aD as FederatedAuthProvider, aE as _persistenceKeyName, aF as _performApiRequest, aG as _getCurrentUrl, aH as _gapiScriptUrl, aI as _emulatorUrl, aJ as _isChromeIOS, aK as _isFirefox, aL as _isIOSStandalone, aM as BaseOAuthProvider, aN as _setWindowLocation, aO as MultiFactorAssertionImpl, aP as finalizeEnrollPhoneMfa, aQ as finalizeSignInPhoneMfa, r as registerAuth, i as initializeAuth, a as indexedDBLocalPersistence, e as beforeAuthStateChanged, o as onIdTokenChanged, c as connectAuthEmulator, aR as _setExternalJSProvider, aS as _isAndroid, aT as _isIOS7Or8 } from './register-7b89e556.js';
2
- export { Y as ActionCodeURL, m as AuthCredential, A as AuthErrorCodes, aV as AuthImpl, E as EmailAuthCredential, q as EmailAuthProvider, F as FacebookAuthProvider, aX as FetchProvider, t as GithubAuthProvider, G as GoogleAuthProvider, O as OAuthCredential, w as OAuthProvider, P as PhoneAuthCredential, aY as SAMLAuthCredential, S as SAMLAuthProvider, T as TotpMultiFactorGenerator, b as TotpSecret, x as TwitterAuthProvider, aU as UserImpl, ae as _assert, am as _castAuth, az as _fail, aC as _generateEventId, aW as _getClientVersion, av as _getInstance, aE as _persistenceKeyName, J as applyActionCode, e as beforeAuthStateChanged, K as checkActionCode, I as confirmPasswordReset, c as connectAuthEmulator, M as createUserWithEmailAndPassword, l as debugErrorMap, k as deleteUser, V as fetchSignInMethodsForEmail, a4 as getAdditionalUserInfo, a1 as getIdToken, a2 as getIdTokenResult, a6 as getMultiFactorResolver, n as inMemoryPersistence, a as indexedDBLocalPersistence, i as initializeAuth, d as initializeRecaptchaConfig, R as isSignInWithEmailLink, B as linkWithCredential, a7 as multiFactor, f as onAuthStateChanged, o as onIdTokenChanged, Z as parseActionCodeURL, p as prodErrorMap, C as reauthenticateWithCredential, a5 as reload, j as revokeAccessToken, W as sendEmailVerification, H as sendPasswordResetEmail, Q as sendSignInLinkToEmail, s as setPersistence, y as signInAnonymously, z as signInWithCredential, D as signInWithCustomToken, N as signInWithEmailAndPassword, U as signInWithEmailLink, h as signOut, a3 as unlink, g as updateCurrentUser, $ as updateEmail, a0 as updatePassword, _ as updateProfile, u as useDeviceLanguage, v as validatePassword, X as verifyBeforeUpdateEmail, L as verifyPasswordResetCode } from './register-7b89e556.js';
1
+ import { a8 as STORAGE_AVAILABLE_KEY, a9 as _isIframe, aa as _isMobileBrowser, ab as _isIE10, ac as _isSafari, ad as _isIOS, ae as _assert, af as Delay, ag as _window, ah as isV2, ai as _createError, aj as _recaptchaV2ScriptUrl, ak as _loadJS, al as _generateCallbackName, am as _castAuth, an as _isHttpOrHttps, ao as _isWorker, ap as getRecaptchaParams, aq as _serverAppCurrentUserOperationNotSupportedError, z as signInWithCredential, ar as _assertLinkedStatus, B as linkWithCredential, C as reauthenticateWithCredential, as as startEnrollPhoneMfa, at as startSignInPhoneMfa, au as sendPhoneVerificationCode, av as _link$1, P as PhoneAuthCredential, aw as _getInstance, ax as _signInWithCredential, ay as _reauthenticate, m as AuthCredential, az as signInWithIdp, aA as _fail, aB as debugAssert, aC as _assertInstanceOf, aD as _generateEventId, aE as FederatedAuthProvider, aF as _persistenceKeyName, aG as _performApiRequest, aH as _getCurrentUrl, aI as _gapiScriptUrl, aJ as _emulatorUrl, aK as _isChromeIOS, aL as _isFirefox, aM as _isIOSStandalone, aN as BaseOAuthProvider, aO as _setWindowLocation, aP as MultiFactorAssertionImpl, aQ as finalizeEnrollPhoneMfa, aR as finalizeSignInPhoneMfa, r as registerAuth, i as initializeAuth, a as indexedDBLocalPersistence, e as beforeAuthStateChanged, o as onIdTokenChanged, c as connectAuthEmulator, aS as _setExternalJSProvider, aT as _isAndroid, aU as _isIOS7Or8 } from './register-3473374b.js';
2
+ export { Y as ActionCodeURL, m as AuthCredential, A as AuthErrorCodes, aW as AuthImpl, E as EmailAuthCredential, q as EmailAuthProvider, F as FacebookAuthProvider, aY as FetchProvider, t as GithubAuthProvider, G as GoogleAuthProvider, O as OAuthCredential, w as OAuthProvider, P as PhoneAuthCredential, aZ as SAMLAuthCredential, S as SAMLAuthProvider, T as TotpMultiFactorGenerator, b as TotpSecret, x as TwitterAuthProvider, aV as UserImpl, ae as _assert, am as _castAuth, aA as _fail, aD as _generateEventId, aX as _getClientVersion, aw as _getInstance, aF as _persistenceKeyName, J as applyActionCode, e as beforeAuthStateChanged, K as checkActionCode, I as confirmPasswordReset, c as connectAuthEmulator, M as createUserWithEmailAndPassword, l as debugErrorMap, k as deleteUser, V as fetchSignInMethodsForEmail, a4 as getAdditionalUserInfo, a1 as getIdToken, a2 as getIdTokenResult, a6 as getMultiFactorResolver, n as inMemoryPersistence, a as indexedDBLocalPersistence, i as initializeAuth, d as initializeRecaptchaConfig, R as isSignInWithEmailLink, B as linkWithCredential, a7 as multiFactor, f as onAuthStateChanged, o as onIdTokenChanged, Z as parseActionCodeURL, p as prodErrorMap, C as reauthenticateWithCredential, a5 as reload, j as revokeAccessToken, W as sendEmailVerification, H as sendPasswordResetEmail, Q as sendSignInLinkToEmail, s as setPersistence, y as signInAnonymously, z as signInWithCredential, D as signInWithCustomToken, N as signInWithEmailAndPassword, U as signInWithEmailLink, h as signOut, a3 as unlink, g as updateCurrentUser, $ as updateEmail, a0 as updatePassword, _ as updateProfile, u as useDeviceLanguage, v as validatePassword, X as verifyBeforeUpdateEmail, L as verifyPasswordResetCode } from './register-3473374b.js';
3
3
  import { getUA, querystring, getModularInstance, isEmpty, getExperimentalSetting, getDefaultEmulatorHost, querystringDecode } from '@firebase/util';
4
+ import { _isFirebaseServerApp, SDK_VERSION, _getProvider, getApp } from '@firebase/app';
4
5
  import 'tslib';
5
- import { SDK_VERSION, _getProvider, getApp } from '@firebase/app';
6
6
  import '@firebase/component';
7
7
  import '@firebase/logger';
8
8
 
@@ -894,7 +894,8 @@ class ConfirmationResultImpl {
894
894
  * {@link RecaptchaVerifier} (like React Native), but you need to use a
895
895
  * third-party {@link ApplicationVerifier} implementation.
896
896
  *
897
- * This method does not work in a Node.js environment.
897
+ * This method does not work in a Node.js environment or with {@link Auth} instances created with a
898
+ * {@link @firebase/app#FirebaseServerApp}.
898
899
  *
899
900
  * @example
900
901
  * ```javascript
@@ -912,6 +913,9 @@ class ConfirmationResultImpl {
912
913
  * @public
913
914
  */
914
915
  async function signInWithPhoneNumber(auth, phoneNumber, appVerifier) {
916
+ if (_isFirebaseServerApp(auth.app)) {
917
+ return Promise.reject(_serverAppCurrentUserOperationNotSupportedError(auth));
918
+ }
915
919
  const authInternal = _castAuth(auth);
916
920
  const verificationId = await _verifyPhoneNumber(authInternal, phoneNumber, getModularInstance(appVerifier));
917
921
  return new ConfirmationResultImpl(verificationId, cred => signInWithCredential(authInternal, cred));
@@ -940,7 +944,8 @@ async function linkWithPhoneNumber(user, phoneNumber, appVerifier) {
940
944
  * @remarks
941
945
  * Use before operations such as {@link updatePassword} that require tokens from recent sign-in attempts.
942
946
  *
943
- * This method does not work in a Node.js environment.
947
+ * This method does not work in a Node.js environment or on any {@link User} signed in by
948
+ * {@link Auth} instances created with a {@link @firebase/app#FirebaseServerApp}.
944
949
  *
945
950
  * @param user - The user.
946
951
  * @param phoneNumber - The user's phone number in E.164 format (e.g. +16505550101).
@@ -950,6 +955,9 @@ async function linkWithPhoneNumber(user, phoneNumber, appVerifier) {
950
955
  */
951
956
  async function reauthenticateWithPhoneNumber(user, phoneNumber, appVerifier) {
952
957
  const userInternal = getModularInstance(user);
958
+ if (_isFirebaseServerApp(userInternal.auth.app)) {
959
+ return Promise.reject(_serverAppCurrentUserOperationNotSupportedError(userInternal.auth));
960
+ }
953
961
  const verificationId = await _verifyPhoneNumber(userInternal.auth, phoneNumber, getModularInstance(appVerifier));
954
962
  return new ConfirmationResultImpl(verificationId, cred => reauthenticateWithCredential(userInternal, cred));
955
963
  }
@@ -1016,7 +1024,8 @@ async function _verifyPhoneNumber(auth, options, verifier) {
1016
1024
  * Updates the user's phone number.
1017
1025
  *
1018
1026
  * @remarks
1019
- * This method does not work in a Node.js environment.
1027
+ * This method does not work in a Node.js environment or on any {@link User} signed in by
1028
+ * {@link Auth} instances created with a {@link @firebase/app#FirebaseServerApp}.
1020
1029
  *
1021
1030
  * @example
1022
1031
  * ```
@@ -1035,7 +1044,11 @@ async function _verifyPhoneNumber(auth, options, verifier) {
1035
1044
  * @public
1036
1045
  */
1037
1046
  async function updatePhoneNumber(user, credential) {
1038
- await _link$1(getModularInstance(user), credential);
1047
+ const userInternal = getModularInstance(user);
1048
+ if (_isFirebaseServerApp(userInternal.auth.app)) {
1049
+ return Promise.reject(_serverAppCurrentUserOperationNotSupportedError(userInternal.auth));
1050
+ }
1051
+ await _link$1(userInternal, credential);
1039
1052
  }
1040
1053
 
1041
1054
  /**
@@ -1421,7 +1434,8 @@ const _POLL_WINDOW_CLOSE_TIMEOUT = new Delay(2000, 10000);
1421
1434
  * If succeeds, returns the signed in user along with the provider's credential. If sign in was
1422
1435
  * unsuccessful, returns an error object containing additional information about the error.
1423
1436
  *
1424
- * This method does not work in a Node.js environment.
1437
+ * This method does not work in a Node.js environment or with {@link Auth} instances created with a
1438
+ * {@link @firebase/app#FirebaseServerApp}.
1425
1439
  *
1426
1440
  * @example
1427
1441
  * ```javascript
@@ -1445,6 +1459,9 @@ const _POLL_WINDOW_CLOSE_TIMEOUT = new Delay(2000, 10000);
1445
1459
  * @public
1446
1460
  */
1447
1461
  async function signInWithPopup(auth, provider, resolver) {
1462
+ if (_isFirebaseServerApp(auth.app)) {
1463
+ return Promise.reject(_createError(auth, "operation-not-supported-in-this-environment" /* AuthErrorCode.OPERATION_NOT_SUPPORTED */));
1464
+ }
1448
1465
  const authInternal = _castAuth(auth);
1449
1466
  _assertInstanceOf(auth, provider, FederatedAuthProvider);
1450
1467
  const resolverInternal = _withDefaultResolver(authInternal, resolver);
@@ -1459,7 +1476,8 @@ async function signInWithPopup(auth, provider, resolver) {
1459
1476
  * If the reauthentication is successful, the returned result will contain the user and the
1460
1477
  * provider's credential.
1461
1478
  *
1462
- * This method does not work in a Node.js environment.
1479
+ * This method does not work in a Node.js environment or on any {@link User} signed in by
1480
+ * {@link Auth} instances created with a {@link @firebase/app#FirebaseServerApp}.
1463
1481
  *
1464
1482
  * @example
1465
1483
  * ```javascript
@@ -1480,6 +1498,9 @@ async function signInWithPopup(auth, provider, resolver) {
1480
1498
  */
1481
1499
  async function reauthenticateWithPopup(user, provider, resolver) {
1482
1500
  const userInternal = getModularInstance(user);
1501
+ if (_isFirebaseServerApp(userInternal.auth.app)) {
1502
+ return Promise.reject(_createError(userInternal.auth, "operation-not-supported-in-this-environment" /* AuthErrorCode.OPERATION_NOT_SUPPORTED */));
1503
+ }
1483
1504
  _assertInstanceOf(userInternal.auth, provider, FederatedAuthProvider);
1484
1505
  const resolverInternal = _withDefaultResolver(userInternal.auth, resolver);
1485
1506
  const action = new PopupOperation(userInternal.auth, "reauthViaPopup" /* AuthEventType.REAUTH_VIA_POPUP */, provider, resolverInternal, userInternal);
@@ -1731,7 +1752,8 @@ function pendingRedirectKey(auth) {
1731
1752
  * Follow the {@link https://firebase.google.com/docs/auth/web/redirect-best-practices
1732
1753
  * | best practices} when using {@link signInWithRedirect}.
1733
1754
  *
1734
- * This method does not work in a Node.js environment.
1755
+ * This method does not work in a Node.js environment or with {@link Auth} instances created with a
1756
+ * {@link @firebase/app#FirebaseServerApp}.
1735
1757
  *
1736
1758
  * @example
1737
1759
  * ```javascript
@@ -1770,6 +1792,9 @@ function signInWithRedirect(auth, provider, resolver) {
1770
1792
  return _signInWithRedirect(auth, provider, resolver);
1771
1793
  }
1772
1794
  async function _signInWithRedirect(auth, provider, resolver) {
1795
+ if (_isFirebaseServerApp(auth.app)) {
1796
+ return Promise.reject(_serverAppCurrentUserOperationNotSupportedError(auth));
1797
+ }
1773
1798
  const authInternal = _castAuth(auth);
1774
1799
  _assertInstanceOf(auth, provider, FederatedAuthProvider);
1775
1800
  // Wait for auth initialization to complete, this will process pending redirects and clear the
@@ -1787,7 +1812,8 @@ async function _signInWithRedirect(auth, provider, resolver) {
1787
1812
  * Follow the {@link https://firebase.google.com/docs/auth/web/redirect-best-practices
1788
1813
  * | best practices} when using {@link reauthenticateWithRedirect}.
1789
1814
  *
1790
- * This method does not work in a Node.js environment.
1815
+ * This method does not work in a Node.js environment or with {@link Auth} instances
1816
+ * created with a {@link @firebase/app#FirebaseServerApp}.
1791
1817
  *
1792
1818
  * @example
1793
1819
  * ```javascript
@@ -1820,6 +1846,9 @@ function reauthenticateWithRedirect(user, provider, resolver) {
1820
1846
  async function _reauthenticateWithRedirect(user, provider, resolver) {
1821
1847
  const userInternal = getModularInstance(user);
1822
1848
  _assertInstanceOf(userInternal.auth, provider, FederatedAuthProvider);
1849
+ if (_isFirebaseServerApp(userInternal.auth.app)) {
1850
+ return Promise.reject(_serverAppCurrentUserOperationNotSupportedError(userInternal.auth));
1851
+ }
1823
1852
  // Wait for auth initialization to complete, this will process pending redirects and clear the
1824
1853
  // PENDING_REDIRECT_KEY in persistence. This should be completed before starting a new
1825
1854
  // redirect and creating a PENDING_REDIRECT_KEY entry.
@@ -1837,7 +1866,8 @@ async function _reauthenticateWithRedirect(user, provider, resolver) {
1837
1866
  * Follow the {@link https://firebase.google.com/docs/auth/web/redirect-best-practices
1838
1867
  * | best practices} when using {@link linkWithRedirect}.
1839
1868
  *
1840
- * This method does not work in a Node.js environment.
1869
+ * This method does not work in a Node.js environment or with {@link Auth} instances
1870
+ * created with a {@link @firebase/app#FirebaseServerApp}.
1841
1871
  *
1842
1872
  * @example
1843
1873
  * ```javascript
@@ -1884,7 +1914,8 @@ async function _linkWithRedirect(user, provider, resolver) {
1884
1914
  * If sign-in succeeded, returns the signed in user. If sign-in was unsuccessful, fails with an
1885
1915
  * error. If no redirect operation was called, returns `null`.
1886
1916
  *
1887
- * This method does not work in a Node.js environment.
1917
+ * This method does not work in a Node.js environment or with {@link Auth} instances created with a
1918
+ * {@link @firebase/app#FirebaseServerApp}.
1888
1919
  *
1889
1920
  * @example
1890
1921
  * ```javascript
@@ -1922,6 +1953,9 @@ async function getRedirectResult(auth, resolver) {
1922
1953
  return _getRedirectResult(auth, resolver, false);
1923
1954
  }
1924
1955
  async function _getRedirectResult(auth, resolverExtern, bypassAuthState = false) {
1956
+ if (_isFirebaseServerApp(auth.app)) {
1957
+ return Promise.reject(_serverAppCurrentUserOperationNotSupportedError(auth));
1958
+ }
1925
1959
  const authInternal = _castAuth(auth);
1926
1960
  const resolver = _withDefaultResolver(authInternal, resolverExtern);
1927
1961
  const action = new RedirectAction(authInternal, resolver, bypassAuthState);
@@ -2748,12 +2782,17 @@ function getAuth(app = getApp()) {
2748
2782
  ]
2749
2783
  });
2750
2784
  const authTokenSyncPath = getExperimentalSetting('authTokenSyncURL');
2751
- // Don't allow urls (XSS possibility), only paths on the same domain
2752
- // (starting with a single '/')
2753
- if (authTokenSyncPath && authTokenSyncPath.match(/^\/[^\/].*/)) {
2754
- const mintCookie = mintCookieFactory(authTokenSyncPath);
2755
- beforeAuthStateChanged(auth, mintCookie, () => mintCookie(auth.currentUser));
2756
- onIdTokenChanged(auth, user => mintCookie(user));
2785
+ // Only do the Cookie exchange in a secure context
2786
+ if (authTokenSyncPath &&
2787
+ typeof isSecureContext === 'boolean' &&
2788
+ isSecureContext) {
2789
+ // Don't allow urls (XSS possibility), only paths on the same domain
2790
+ const authTokenSyncUrl = new URL(authTokenSyncPath, location.origin);
2791
+ if (location.origin === authTokenSyncUrl.origin) {
2792
+ const mintCookie = mintCookieFactory(authTokenSyncUrl.toString());
2793
+ beforeAuthStateChanged(auth, mintCookie, () => mintCookie(auth.currentUser));
2794
+ onIdTokenChanged(auth, user => mintCookie(user));
2795
+ }
2757
2796
  }
2758
2797
  const authEmulatorHost = getDefaultEmulatorHost('auth');
2759
2798
  if (authEmulatorHost) {