@firebase/auth 0.19.3-canary.dc6b447ba → 0.19.4-2021118224937

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 (68) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/dist/auth.d.ts +1 -1
  3. package/dist/cordova/index.js +2 -2
  4. package/dist/cordova/internal.js +2 -2
  5. package/dist/cordova/{popup_redirect-3b2fa37d.js → popup_redirect-1b8dd477.js} +69 -41
  6. package/dist/cordova/popup_redirect-1b8dd477.js.map +1 -0
  7. package/dist/cordova/popup_redirect-9a2eae53.js +9846 -0
  8. package/dist/cordova/popup_redirect-9a2eae53.js.map +1 -0
  9. package/dist/cordova/src/api/index.d.ts +2 -1
  10. package/dist/cordova/src/core/auth/auth_impl.d.ts +1 -1
  11. package/dist/cordova/src/model/auth.d.ts +1 -1
  12. package/dist/esm2017/{index-d2de5dea.js → index-72c6cbb2.js} +19 -14
  13. package/dist/esm2017/index-72c6cbb2.js.map +1 -0
  14. package/dist/esm2017/index-83fa940a.js +9329 -0
  15. package/dist/esm2017/index-83fa940a.js.map +1 -0
  16. package/dist/esm2017/index.js +1 -1
  17. package/dist/esm2017/internal.js +2 -2
  18. package/dist/esm2017/src/api/index.d.ts +2 -1
  19. package/dist/esm2017/src/core/auth/auth_impl.d.ts +1 -1
  20. package/dist/esm2017/src/model/auth.d.ts +1 -1
  21. package/dist/esm5/{index-47bb602b.js → index-33d359bb.js} +69 -41
  22. package/dist/esm5/index-33d359bb.js.map +1 -0
  23. package/dist/esm5/index-93eaec86.js +11081 -0
  24. package/dist/esm5/index-93eaec86.js.map +1 -0
  25. package/dist/esm5/index.js +1 -1
  26. package/dist/esm5/internal.js +2 -2
  27. package/dist/esm5/src/api/index.d.ts +2 -1
  28. package/dist/esm5/src/core/auth/auth_impl.d.ts +1 -1
  29. package/dist/esm5/src/model/auth.d.ts +1 -1
  30. package/dist/index.webworker.esm5.js +68 -40
  31. package/dist/index.webworker.esm5.js.map +1 -1
  32. package/dist/node/index-147e89a8.js +7238 -0
  33. package/dist/node/index-147e89a8.js.map +1 -0
  34. package/dist/node/{index-78dad822.js → index-db8366a9.js} +69 -41
  35. package/dist/node/index-db8366a9.js.map +1 -0
  36. package/dist/node/index.js +1 -1
  37. package/dist/node/internal.js +1 -1
  38. package/dist/node/src/api/index.d.ts +2 -1
  39. package/dist/node/src/core/auth/auth_impl.d.ts +1 -1
  40. package/dist/node/src/model/auth.d.ts +1 -1
  41. package/dist/node-esm/index-5da0ebf8.js +6040 -0
  42. package/dist/node-esm/index-5da0ebf8.js.map +1 -0
  43. package/dist/node-esm/{index-770697f0.js → index-e4ebaa59.js} +19 -14
  44. package/dist/node-esm/index-e4ebaa59.js.map +1 -0
  45. package/dist/node-esm/index.js +1 -1
  46. package/dist/node-esm/internal.js +2 -2
  47. package/dist/node-esm/src/api/index.d.ts +2 -1
  48. package/dist/node-esm/src/core/auth/auth_impl.d.ts +1 -1
  49. package/dist/node-esm/src/model/auth.d.ts +1 -1
  50. package/dist/rn/index.js +1 -1
  51. package/dist/rn/internal.js +1 -1
  52. package/dist/rn/phone-0cff06f5.js +8315 -0
  53. package/dist/rn/phone-0cff06f5.js.map +1 -0
  54. package/dist/rn/{phone-7d32c4dd.js → phone-63150443.js} +69 -41
  55. package/dist/rn/phone-63150443.js.map +1 -0
  56. package/dist/rn/src/api/index.d.ts +2 -1
  57. package/dist/rn/src/core/auth/auth_impl.d.ts +1 -1
  58. package/dist/rn/src/model/auth.d.ts +1 -1
  59. package/dist/src/api/index.d.ts +2 -1
  60. package/dist/src/core/auth/auth_impl.d.ts +1 -1
  61. package/dist/src/model/auth.d.ts +1 -1
  62. package/package.json +6 -6
  63. package/dist/cordova/popup_redirect-3b2fa37d.js.map +0 -1
  64. package/dist/esm2017/index-d2de5dea.js.map +0 -1
  65. package/dist/esm5/index-47bb602b.js.map +0 -1
  66. package/dist/node/index-78dad822.js.map +0 -1
  67. package/dist/node-esm/index-770697f0.js.map +0 -1
  68. package/dist/rn/phone-7d32c4dd.js.map +0 -1
@@ -1,4 +1,4 @@
1
- export { A as ActionCodeOperation, ac as ActionCodeURL, G as AuthCredential, C as AuthErrorCodes, H as EmailAuthCredential, L as EmailAuthProvider, M as FacebookAuthProvider, F as FactorId, Q as GithubAuthProvider, N as GoogleAuthProvider, I as OAuthCredential, T as OAuthProvider, O as OperationType, J as PhoneAuthCredential, P as PhoneAuthProvider, m as PhoneMultiFactorGenerator, o as ProviderId, R as RecaptchaVerifier, U as SAMLAuthProvider, S as SignInMethod, V as TwitterAuthProvider, a1 as applyActionCode, b as browserLocalPersistence, k as browserPopupRedirectResolver, a as browserSessionPersistence, a2 as checkActionCode, a0 as confirmPasswordReset, E as connectAuthEmulator, a4 as createUserWithEmailAndPassword, z as debugErrorMap, y as deleteUser, a9 as fetchSignInMethodsForEmail, ak as getAdditionalUserInfo, n as getAuth, ah as getIdToken, ai as getIdTokenResult, am as getMultiFactorResolver, j as getRedirectResult, K as inMemoryPersistence, i as indexedDBLocalPersistence, D as initializeAuth, a7 as isSignInWithEmailLink, Y as linkWithCredential, l as linkWithPhoneNumber, d as linkWithPopup, g as linkWithRedirect, an as multiFactor, t as onAuthStateChanged, q as onIdTokenChanged, ad as parseActionCodeURL, B as prodErrorMap, Z as reauthenticateWithCredential, r as reauthenticateWithPhoneNumber, e as reauthenticateWithPopup, h as reauthenticateWithRedirect, al as reload, aa as sendEmailVerification, $ as sendPasswordResetEmail, a6 as sendSignInLinkToEmail, p as setPersistence, W as signInAnonymously, X as signInWithCredential, _ as signInWithCustomToken, a5 as signInWithEmailAndPassword, a8 as signInWithEmailLink, s as signInWithPhoneNumber, c as signInWithPopup, f as signInWithRedirect, x as signOut, aj as unlink, w as updateCurrentUser, af as updateEmail, ag as updatePassword, u as updatePhoneNumber, ae as updateProfile, v as useDeviceLanguage, ab as verifyBeforeUpdateEmail, a3 as verifyPasswordResetCode } from './index-47bb602b.js';
1
+ export { A as ActionCodeOperation, ac as ActionCodeURL, G as AuthCredential, C as AuthErrorCodes, H as EmailAuthCredential, L as EmailAuthProvider, M as FacebookAuthProvider, F as FactorId, Q as GithubAuthProvider, N as GoogleAuthProvider, I as OAuthCredential, T as OAuthProvider, O as OperationType, J as PhoneAuthCredential, P as PhoneAuthProvider, m as PhoneMultiFactorGenerator, o as ProviderId, R as RecaptchaVerifier, U as SAMLAuthProvider, S as SignInMethod, V as TwitterAuthProvider, a1 as applyActionCode, b as browserLocalPersistence, k as browserPopupRedirectResolver, a as browserSessionPersistence, a2 as checkActionCode, a0 as confirmPasswordReset, E as connectAuthEmulator, a4 as createUserWithEmailAndPassword, z as debugErrorMap, y as deleteUser, a9 as fetchSignInMethodsForEmail, ak as getAdditionalUserInfo, n as getAuth, ah as getIdToken, ai as getIdTokenResult, am as getMultiFactorResolver, j as getRedirectResult, K as inMemoryPersistence, i as indexedDBLocalPersistence, D as initializeAuth, a7 as isSignInWithEmailLink, Y as linkWithCredential, l as linkWithPhoneNumber, d as linkWithPopup, g as linkWithRedirect, an as multiFactor, t as onAuthStateChanged, q as onIdTokenChanged, ad as parseActionCodeURL, B as prodErrorMap, Z as reauthenticateWithCredential, r as reauthenticateWithPhoneNumber, e as reauthenticateWithPopup, h as reauthenticateWithRedirect, al as reload, aa as sendEmailVerification, $ as sendPasswordResetEmail, a6 as sendSignInLinkToEmail, p as setPersistence, W as signInAnonymously, X as signInWithCredential, _ as signInWithCustomToken, a5 as signInWithEmailAndPassword, a8 as signInWithEmailLink, s as signInWithPhoneNumber, c as signInWithPopup, f as signInWithRedirect, x as signOut, aj as unlink, w as updateCurrentUser, af as updateEmail, ag as updatePassword, u as updatePhoneNumber, ae as updateProfile, v as useDeviceLanguage, ab as verifyBeforeUpdateEmail, a3 as verifyPasswordResetCode } from './index-93eaec86.js';
2
2
  import 'tslib';
3
3
  import '@firebase/util';
4
4
  import '@firebase/app';
@@ -1,5 +1,5 @@
1
- import { ao as _isAndroid, ap as _isIOS7Or8, aq as _isIOS, ar as _fail, as as _getRedirectUrl, at as debugAssert, au as _getProjectConfig, av as _createError, aw as _assert, ax as AuthEventManager, ay as _getInstance, b as browserLocalPersistence, az as _persistenceKeyName, aA as _clearRedirectOutcomes, a as browserSessionPersistence, aB as _getRedirectResult, aC as _castAuth } from './index-47bb602b.js';
2
- export { A as ActionCodeOperation, ac as ActionCodeURL, G as AuthCredential, C as AuthErrorCodes, aE as AuthImpl, aH as AuthPopup, H as EmailAuthCredential, L as EmailAuthProvider, M as FacebookAuthProvider, F as FactorId, aI as FetchProvider, Q as GithubAuthProvider, N as GoogleAuthProvider, I as OAuthCredential, T as OAuthProvider, O as OperationType, J as PhoneAuthCredential, P as PhoneAuthProvider, m as PhoneMultiFactorGenerator, o as ProviderId, R as RecaptchaVerifier, aJ as SAMLAuthCredential, U as SAMLAuthProvider, S as SignInMethod, V as TwitterAuthProvider, aD as UserImpl, aw as _assert, aC as _castAuth, ar as _fail, aG as _generateEventId, aF as _getClientVersion, ay as _getInstance, aB as _getRedirectResult, az as _persistenceKeyName, a1 as applyActionCode, b as browserLocalPersistence, k as browserPopupRedirectResolver, a as browserSessionPersistence, a2 as checkActionCode, a0 as confirmPasswordReset, E as connectAuthEmulator, a4 as createUserWithEmailAndPassword, z as debugErrorMap, y as deleteUser, a9 as fetchSignInMethodsForEmail, ak as getAdditionalUserInfo, n as getAuth, ah as getIdToken, ai as getIdTokenResult, am as getMultiFactorResolver, j as getRedirectResult, K as inMemoryPersistence, i as indexedDBLocalPersistence, D as initializeAuth, a7 as isSignInWithEmailLink, Y as linkWithCredential, l as linkWithPhoneNumber, d as linkWithPopup, g as linkWithRedirect, an as multiFactor, t as onAuthStateChanged, q as onIdTokenChanged, ad as parseActionCodeURL, B as prodErrorMap, Z as reauthenticateWithCredential, r as reauthenticateWithPhoneNumber, e as reauthenticateWithPopup, h as reauthenticateWithRedirect, al as reload, aa as sendEmailVerification, $ as sendPasswordResetEmail, a6 as sendSignInLinkToEmail, p as setPersistence, W as signInAnonymously, X as signInWithCredential, _ as signInWithCustomToken, a5 as signInWithEmailAndPassword, a8 as signInWithEmailLink, s as signInWithPhoneNumber, c as signInWithPopup, f as signInWithRedirect, x as signOut, aj as unlink, w as updateCurrentUser, af as updateEmail, ag as updatePassword, u as updatePhoneNumber, ae as updateProfile, v as useDeviceLanguage, ab as verifyBeforeUpdateEmail, a3 as verifyPasswordResetCode } from './index-47bb602b.js';
1
+ import { ao as _isAndroid, ap as _isIOS7Or8, aq as _isIOS, ar as _fail, as as _getRedirectUrl, at as debugAssert, au as _getProjectConfig, av as _createError, aw as _assert, ax as AuthEventManager, ay as _getInstance, b as browserLocalPersistence, az as _persistenceKeyName, aA as _clearRedirectOutcomes, a as browserSessionPersistence, aB as _getRedirectResult, aC as _castAuth } from './index-93eaec86.js';
2
+ export { A as ActionCodeOperation, ac as ActionCodeURL, G as AuthCredential, C as AuthErrorCodes, aE as AuthImpl, aH as AuthPopup, H as EmailAuthCredential, L as EmailAuthProvider, M as FacebookAuthProvider, F as FactorId, aI as FetchProvider, Q as GithubAuthProvider, N as GoogleAuthProvider, I as OAuthCredential, T as OAuthProvider, O as OperationType, J as PhoneAuthCredential, P as PhoneAuthProvider, m as PhoneMultiFactorGenerator, o as ProviderId, R as RecaptchaVerifier, aJ as SAMLAuthCredential, U as SAMLAuthProvider, S as SignInMethod, V as TwitterAuthProvider, aD as UserImpl, aw as _assert, aC as _castAuth, ar as _fail, aG as _generateEventId, aF as _getClientVersion, ay as _getInstance, aB as _getRedirectResult, az as _persistenceKeyName, a1 as applyActionCode, b as browserLocalPersistence, k as browserPopupRedirectResolver, a as browserSessionPersistence, a2 as checkActionCode, a0 as confirmPasswordReset, E as connectAuthEmulator, a4 as createUserWithEmailAndPassword, z as debugErrorMap, y as deleteUser, a9 as fetchSignInMethodsForEmail, ak as getAdditionalUserInfo, n as getAuth, ah as getIdToken, ai as getIdTokenResult, am as getMultiFactorResolver, j as getRedirectResult, K as inMemoryPersistence, i as indexedDBLocalPersistence, D as initializeAuth, a7 as isSignInWithEmailLink, Y as linkWithCredential, l as linkWithPhoneNumber, d as linkWithPopup, g as linkWithRedirect, an as multiFactor, t as onAuthStateChanged, q as onIdTokenChanged, ad as parseActionCodeURL, B as prodErrorMap, Z as reauthenticateWithCredential, r as reauthenticateWithPhoneNumber, e as reauthenticateWithPopup, h as reauthenticateWithRedirect, al as reload, aa as sendEmailVerification, $ as sendPasswordResetEmail, a6 as sendSignInLinkToEmail, p as setPersistence, W as signInAnonymously, X as signInWithCredential, _ as signInWithCustomToken, a5 as signInWithEmailAndPassword, a8 as signInWithEmailLink, s as signInWithPhoneNumber, c as signInWithPopup, f as signInWithRedirect, x as signOut, aj as unlink, w as updateCurrentUser, af as updateEmail, ag as updatePassword, u as updatePhoneNumber, ae as updateProfile, v as useDeviceLanguage, ab as verifyBeforeUpdateEmail, a3 as verifyPasswordResetCode } from './index-93eaec86.js';
3
3
  import { __awaiter, __generator, __extends } from 'tslib';
4
4
  import { querystringDecode } from '@firebase/util';
5
5
  import '@firebase/app';
@@ -27,7 +27,8 @@ export declare const enum HttpMethod {
27
27
  export declare const enum HttpHeader {
28
28
  CONTENT_TYPE = "Content-Type",
29
29
  X_FIREBASE_LOCALE = "X-Firebase-Locale",
30
- X_CLIENT_VERSION = "X-Client-Version"
30
+ X_CLIENT_VERSION = "X-Client-Version",
31
+ X_FIREBASE_GMPID = "X-Firebase-gmpid"
31
32
  }
32
33
  export declare const enum Endpoint {
33
34
  CREATE_AUTH_URI = "/v1/accounts:createAuthUri",
@@ -95,7 +95,7 @@ export declare class AuthImpl implements AuthInternal, _FirebaseService {
95
95
  private clientVersion;
96
96
  _logFramework(framework: string): void;
97
97
  _getFrameworks(): readonly string[];
98
- _getSdkClientVersion(): string;
98
+ _getAdditionalHeaders(): Promise<Record<string, string>>;
99
99
  }
100
100
  /**
101
101
  * Method to be used to cast down to our private implmentation of Auth.
@@ -63,7 +63,7 @@ export interface AuthInternal extends Auth {
63
63
  _getPersistence(): string;
64
64
  _logFramework(framework: string): void;
65
65
  _getFrameworks(): readonly string[];
66
- _getSdkClientVersion(): string;
66
+ _getAdditionalHeaders(): Promise<Record<string, string>>;
67
67
  readonly name: AppName;
68
68
  readonly config: ConfigInternal;
69
69
  languageCode: string | null;
@@ -522,7 +522,7 @@ function _initializeAuthInstance(auth, deps) {
522
522
  }
523
523
 
524
524
  var name = "@firebase/auth";
525
- var version = "0.19.3-canary.dc6b447ba";
525
+ var version = "0.19.4-2021118224937";
526
526
 
527
527
  /**
528
528
  * @license
@@ -980,30 +980,38 @@ function _addTidIfNecessary(auth, request) {
980
980
  function _performApiRequest(auth, method, path, request, customErrorMap) {
981
981
  if (customErrorMap === void 0) { customErrorMap = {}; }
982
982
  return __awaiter(this, void 0, void 0, function () {
983
+ var _this = this;
983
984
  return __generator(this, function (_a) {
984
- return [2 /*return*/, _performFetchWithErrorHandling(auth, customErrorMap, function () {
985
- var body = {};
986
- var params = {};
987
- if (request) {
988
- if (method === "GET" /* GET */) {
989
- params = request;
990
- }
991
- else {
992
- body = {
993
- body: JSON.stringify(request)
994
- };
985
+ return [2 /*return*/, _performFetchWithErrorHandling(auth, customErrorMap, function () { return __awaiter(_this, void 0, void 0, function () {
986
+ var body, params, query, headers;
987
+ return __generator(this, function (_a) {
988
+ switch (_a.label) {
989
+ case 0:
990
+ body = {};
991
+ params = {};
992
+ if (request) {
993
+ if (method === "GET" /* GET */) {
994
+ params = request;
995
+ }
996
+ else {
997
+ body = {
998
+ body: JSON.stringify(request)
999
+ };
1000
+ }
1001
+ }
1002
+ query = querystring(__assign({ key: auth.config.apiKey }, params)).slice(1);
1003
+ return [4 /*yield*/, auth._getAdditionalHeaders()];
1004
+ case 1:
1005
+ headers = _a.sent();
1006
+ headers["Content-Type" /* CONTENT_TYPE */] = 'application/json';
1007
+ if (auth.languageCode) {
1008
+ headers["X-Firebase-Locale" /* X_FIREBASE_LOCALE */] = auth.languageCode;
1009
+ }
1010
+ return [2 /*return*/, FetchProvider.fetch()(_getFinalTarget(auth, auth.config.apiHost, path, query), __assign({ method: method,
1011
+ headers: headers, referrerPolicy: 'no-referrer' }, body))];
995
1012
  }
996
- }
997
- var query = querystring(__assign({ key: auth.config.apiKey }, params)).slice(1);
998
- var headers = new (FetchProvider.headers())();
999
- headers.set("Content-Type" /* CONTENT_TYPE */, 'application/json');
1000
- headers.set("X-Client-Version" /* X_CLIENT_VERSION */, auth._getSdkClientVersion());
1001
- if (auth.languageCode) {
1002
- headers.set("X-Firebase-Locale" /* X_FIREBASE_LOCALE */, auth.languageCode);
1003
- }
1004
- return FetchProvider.fetch()(_getFinalTarget(auth, auth.config.apiHost, path, query), __assign({ method: method,
1005
- headers: headers, referrerPolicy: 'no-referrer' }, body));
1006
- })];
1013
+ });
1014
+ }); })];
1007
1015
  });
1008
1016
  });
1009
1017
  }
@@ -1634,24 +1642,32 @@ function extractProviderData(providers) {
1634
1642
  function requestStsToken(auth, refreshToken) {
1635
1643
  return __awaiter(this, void 0, void 0, function () {
1636
1644
  var response;
1645
+ var _this = this;
1637
1646
  return __generator(this, function (_a) {
1638
1647
  switch (_a.label) {
1639
- case 0: return [4 /*yield*/, _performFetchWithErrorHandling(auth, {}, function () {
1640
- var body = querystring({
1641
- 'grant_type': 'refresh_token',
1642
- 'refresh_token': refreshToken
1643
- }).slice(1);
1644
- var _a = auth.config, tokenApiHost = _a.tokenApiHost, apiKey = _a.apiKey;
1645
- var url = _getFinalTarget(auth, tokenApiHost, "/v1/token" /* TOKEN */, "key=" + apiKey);
1646
- return FetchProvider.fetch()(url, {
1647
- method: "POST" /* POST */,
1648
- headers: {
1649
- 'X-Client-Version': auth._getSdkClientVersion(),
1650
- 'Content-Type': 'application/x-www-form-urlencoded'
1651
- },
1652
- body: body
1648
+ case 0: return [4 /*yield*/, _performFetchWithErrorHandling(auth, {}, function () { return __awaiter(_this, void 0, void 0, function () {
1649
+ var body, _a, tokenApiHost, apiKey, url, headers;
1650
+ return __generator(this, function (_b) {
1651
+ switch (_b.label) {
1652
+ case 0:
1653
+ body = querystring({
1654
+ 'grant_type': 'refresh_token',
1655
+ 'refresh_token': refreshToken
1656
+ }).slice(1);
1657
+ _a = auth.config, tokenApiHost = _a.tokenApiHost, apiKey = _a.apiKey;
1658
+ url = _getFinalTarget(auth, tokenApiHost, "/v1/token" /* TOKEN */, "key=" + apiKey);
1659
+ return [4 /*yield*/, auth._getAdditionalHeaders()];
1660
+ case 1:
1661
+ headers = _b.sent();
1662
+ headers["Content-Type" /* CONTENT_TYPE */] = 'application/x-www-form-urlencoded';
1663
+ return [2 /*return*/, FetchProvider.fetch()(url, {
1664
+ method: "POST" /* POST */,
1665
+ headers: headers,
1666
+ body: body
1667
+ })];
1668
+ }
1653
1669
  });
1654
- })];
1670
+ }); })];
1655
1671
  case 1:
1656
1672
  response = _a.sent();
1657
1673
  // The response comes back in snake_case. Convert to camel:
@@ -2850,8 +2866,20 @@ var AuthImpl = /** @class */ (function () {
2850
2866
  AuthImpl.prototype._getFrameworks = function () {
2851
2867
  return this.frameworks;
2852
2868
  };
2853
- AuthImpl.prototype._getSdkClientVersion = function () {
2854
- return this.clientVersion;
2869
+ AuthImpl.prototype._getAdditionalHeaders = function () {
2870
+ return __awaiter(this, void 0, void 0, function () {
2871
+ var headers;
2872
+ var _a;
2873
+ return __generator(this, function (_b) {
2874
+ headers = (_a = {},
2875
+ _a["X-Client-Version" /* X_CLIENT_VERSION */] = this.clientVersion,
2876
+ _a);
2877
+ if (this.app.options.appId) {
2878
+ headers["X-Firebase-gmpid" /* X_FIREBASE_GMPID */] = this.app.options.appId;
2879
+ }
2880
+ return [2 /*return*/, headers];
2881
+ });
2882
+ });
2855
2883
  };
2856
2884
  return AuthImpl;
2857
2885
  }());