@firebase/auth 0.22.0-canary.852ded64d → 0.22.0-canary.ea3849fff

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 (91) hide show
  1. package/dist/auth.d.ts +1 -0
  2. package/dist/browser-cjs/{index-845ba5cf.js → index-a4932583.js} +62 -26
  3. package/dist/browser-cjs/index-a4932583.js.map +1 -0
  4. package/dist/browser-cjs/index.js +1 -1
  5. package/dist/browser-cjs/internal.js +1 -1
  6. package/dist/browser-cjs/src/api/index.d.ts +2 -1
  7. package/dist/browser-cjs/src/core/auth/auth_impl.d.ts +4 -1
  8. package/dist/browser-cjs/src/core/util/handler.d.ts +1 -1
  9. package/dist/browser-cjs/src/core/util/log.d.ts +1 -0
  10. package/dist/browser-cjs/src/model/auth.d.ts +1 -0
  11. package/dist/browser-cjs/test/helpers/mock_auth.d.ts +5 -0
  12. package/dist/cordova/index.js +2 -2
  13. package/dist/cordova/internal.js +15 -6
  14. package/dist/cordova/internal.js.map +1 -1
  15. package/dist/cordova/{popup_redirect-77fcd73a.js → popup_redirect-e2867f33.js} +120 -64
  16. package/dist/cordova/popup_redirect-e2867f33.js.map +1 -0
  17. package/dist/cordova/src/api/index.d.ts +2 -1
  18. package/dist/cordova/src/core/auth/auth_impl.d.ts +4 -1
  19. package/dist/cordova/src/core/util/handler.d.ts +1 -1
  20. package/dist/cordova/src/core/util/log.d.ts +1 -0
  21. package/dist/cordova/src/model/auth.d.ts +1 -0
  22. package/dist/cordova/test/helpers/mock_auth.d.ts +5 -0
  23. package/dist/esm2017/{index-c088f05c.js → index-5eca8e8e.js} +62 -26
  24. package/dist/esm2017/index-5eca8e8e.js.map +1 -0
  25. package/dist/esm2017/index.js +1 -1
  26. package/dist/esm2017/internal.js +2 -2
  27. package/dist/esm2017/src/api/index.d.ts +2 -1
  28. package/dist/esm2017/src/core/auth/auth_impl.d.ts +4 -1
  29. package/dist/esm2017/src/core/util/handler.d.ts +1 -1
  30. package/dist/esm2017/src/core/util/log.d.ts +1 -0
  31. package/dist/esm2017/src/model/auth.d.ts +1 -0
  32. package/dist/esm2017/test/helpers/mock_auth.d.ts +5 -0
  33. package/dist/esm5/{index-7119ea16.js → index-ea49ccf6.js} +133 -68
  34. package/dist/esm5/index-ea49ccf6.js.map +1 -0
  35. package/dist/esm5/index.js +1 -1
  36. package/dist/esm5/internal.js +2 -2
  37. package/dist/esm5/src/api/index.d.ts +2 -1
  38. package/dist/esm5/src/core/auth/auth_impl.d.ts +4 -1
  39. package/dist/esm5/src/core/util/handler.d.ts +1 -1
  40. package/dist/esm5/src/core/util/log.d.ts +1 -0
  41. package/dist/esm5/src/model/auth.d.ts +1 -0
  42. package/dist/esm5/test/helpers/mock_auth.d.ts +5 -0
  43. package/dist/index.webworker.esm5.js +59 -22
  44. package/dist/index.webworker.esm5.js.map +1 -1
  45. package/dist/node/index.js +1 -1
  46. package/dist/node/internal.js +61 -42
  47. package/dist/node/internal.js.map +1 -1
  48. package/dist/node/src/api/index.d.ts +2 -1
  49. package/dist/node/src/core/auth/auth_impl.d.ts +4 -1
  50. package/dist/node/src/core/util/handler.d.ts +1 -1
  51. package/dist/node/src/core/util/log.d.ts +1 -0
  52. package/dist/node/src/model/auth.d.ts +1 -0
  53. package/dist/node/test/helpers/mock_auth.d.ts +5 -0
  54. package/dist/node/{totp-220d9279.js → totp-e4b57fc2.js} +60 -23
  55. package/dist/node/totp-e4b57fc2.js.map +1 -0
  56. package/dist/node-esm/index.js +1 -1
  57. package/dist/node-esm/internal.js +16 -4
  58. package/dist/node-esm/internal.js.map +1 -1
  59. package/dist/node-esm/src/api/index.d.ts +2 -1
  60. package/dist/node-esm/src/core/auth/auth_impl.d.ts +4 -1
  61. package/dist/node-esm/src/core/util/handler.d.ts +1 -1
  62. package/dist/node-esm/src/core/util/log.d.ts +1 -0
  63. package/dist/node-esm/src/model/auth.d.ts +1 -0
  64. package/dist/node-esm/test/helpers/mock_auth.d.ts +5 -0
  65. package/dist/node-esm/{totp-3a805e5d.js → totp-3a67b88c.js} +45 -22
  66. package/dist/node-esm/totp-3a67b88c.js.map +1 -0
  67. package/dist/rn/index.js +1 -1
  68. package/dist/rn/internal.js +74 -46
  69. package/dist/rn/internal.js.map +1 -1
  70. package/dist/rn/{phone-a751cf13.js → phone-6ea1b9dd.js} +60 -23
  71. package/dist/rn/phone-6ea1b9dd.js.map +1 -0
  72. package/dist/rn/src/api/index.d.ts +2 -1
  73. package/dist/rn/src/core/auth/auth_impl.d.ts +4 -1
  74. package/dist/rn/src/core/util/handler.d.ts +1 -1
  75. package/dist/rn/src/core/util/log.d.ts +1 -0
  76. package/dist/rn/src/model/auth.d.ts +1 -0
  77. package/dist/rn/test/helpers/mock_auth.d.ts +5 -0
  78. package/dist/src/api/index.d.ts +2 -1
  79. package/dist/src/core/auth/auth_impl.d.ts +4 -1
  80. package/dist/src/core/util/handler.d.ts +1 -1
  81. package/dist/src/core/util/log.d.ts +1 -0
  82. package/dist/src/model/auth.d.ts +1 -0
  83. package/dist/test/helpers/mock_auth.d.ts +5 -0
  84. package/package.json +6 -6
  85. package/dist/browser-cjs/index-845ba5cf.js.map +0 -1
  86. package/dist/cordova/popup_redirect-77fcd73a.js.map +0 -1
  87. package/dist/esm2017/index-c088f05c.js.map +0 -1
  88. package/dist/esm5/index-7119ea16.js.map +0 -1
  89. package/dist/node/totp-220d9279.js.map +0 -1
  90. package/dist/node-esm/totp-3a805e5d.js.map +0 -1
  91. package/dist/rn/phone-a751cf13.js.map +0 -1
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var totp = require('./totp-220d9279.js');
5
+ var totp = require('./totp-e4b57fc2.js');
6
6
  require('tslib');
7
7
  require('@firebase/util');
8
8
  require('@firebase/app');
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var totp = require('./totp-220d9279.js');
5
+ var totp = require('./totp-e4b57fc2.js');
6
6
  var tslib = require('tslib');
7
7
  var util = require('@firebase/util');
8
8
  var app = require('@firebase/app');
@@ -630,48 +630,67 @@ var WIDGET_PATH = '__/auth/handler';
630
630
  * @internal
631
631
  */
632
632
  var EMULATOR_WIDGET_PATH = 'emulator/auth/handler';
633
+ /**
634
+ * Fragment name for the App Check token that gets passed to the widget
635
+ *
636
+ * @internal
637
+ */
638
+ var FIREBASE_APP_CHECK_FRAGMENT_ID = encodeURIComponent('fac');
633
639
  function _getRedirectUrl(auth, provider, authType, redirectUrl, eventId, additionalParams) {
634
- totp._assert(auth.config.authDomain, auth, "auth-domain-config-required" /* AuthErrorCode.MISSING_AUTH_DOMAIN */);
635
- totp._assert(auth.config.apiKey, auth, "invalid-api-key" /* AuthErrorCode.INVALID_API_KEY */);
636
- var params = {
637
- apiKey: auth.config.apiKey,
638
- appName: auth.name,
639
- authType: authType,
640
- redirectUrl: redirectUrl,
641
- v: app.SDK_VERSION,
642
- eventId: eventId
643
- };
644
- if (provider instanceof totp.FederatedAuthProvider) {
645
- provider.setDefaultLanguage(auth.languageCode);
646
- params.providerId = provider.providerId || '';
647
- if (!util.isEmpty(provider.getCustomParameters())) {
648
- params.customParameters = JSON.stringify(provider.getCustomParameters());
649
- }
650
- // TODO set additionalParams from the provider as well?
651
- for (var _i = 0, _a = Object.entries(additionalParams || {}); _i < _a.length; _i++) {
652
- var _b = _a[_i], key = _b[0], value = _b[1];
653
- params[key] = value;
654
- }
655
- }
656
- if (provider instanceof totp.BaseOAuthProvider) {
657
- var scopes = provider.getScopes().filter(function (scope) { return scope !== ''; });
658
- if (scopes.length > 0) {
659
- params.scopes = scopes.join(',');
660
- }
661
- }
662
- if (auth.tenantId) {
663
- params.tid = auth.tenantId;
664
- }
665
- // TODO: maybe set eid as endipointId
666
- // TODO: maybe set fw as Frameworks.join(",")
667
- var paramsDict = params;
668
- for (var _c = 0, _d = Object.keys(paramsDict); _c < _d.length; _c++) {
669
- var key = _d[_c];
670
- if (paramsDict[key] === undefined) {
671
- delete paramsDict[key];
672
- }
673
- }
674
- return "".concat(getHandlerBase(auth), "?").concat(util.querystring(paramsDict).slice(1));
640
+ return tslib.__awaiter(this, void 0, void 0, function () {
641
+ var params, _i, _a, _b, key, value, scopes, paramsDict, _c, _d, key, appCheckToken, appCheckTokenFragment;
642
+ return tslib.__generator(this, function (_e) {
643
+ switch (_e.label) {
644
+ case 0:
645
+ totp._assert(auth.config.authDomain, auth, "auth-domain-config-required" /* AuthErrorCode.MISSING_AUTH_DOMAIN */);
646
+ totp._assert(auth.config.apiKey, auth, "invalid-api-key" /* AuthErrorCode.INVALID_API_KEY */);
647
+ params = {
648
+ apiKey: auth.config.apiKey,
649
+ appName: auth.name,
650
+ authType: authType,
651
+ redirectUrl: redirectUrl,
652
+ v: app.SDK_VERSION,
653
+ eventId: eventId
654
+ };
655
+ if (provider instanceof totp.FederatedAuthProvider) {
656
+ provider.setDefaultLanguage(auth.languageCode);
657
+ params.providerId = provider.providerId || '';
658
+ if (!util.isEmpty(provider.getCustomParameters())) {
659
+ params.customParameters = JSON.stringify(provider.getCustomParameters());
660
+ }
661
+ // TODO set additionalParams from the provider as well?
662
+ for (_i = 0, _a = Object.entries(additionalParams || {}); _i < _a.length; _i++) {
663
+ _b = _a[_i], key = _b[0], value = _b[1];
664
+ params[key] = value;
665
+ }
666
+ }
667
+ if (provider instanceof totp.BaseOAuthProvider) {
668
+ scopes = provider.getScopes().filter(function (scope) { return scope !== ''; });
669
+ if (scopes.length > 0) {
670
+ params.scopes = scopes.join(',');
671
+ }
672
+ }
673
+ if (auth.tenantId) {
674
+ params.tid = auth.tenantId;
675
+ }
676
+ paramsDict = params;
677
+ for (_c = 0, _d = Object.keys(paramsDict); _c < _d.length; _c++) {
678
+ key = _d[_c];
679
+ if (paramsDict[key] === undefined) {
680
+ delete paramsDict[key];
681
+ }
682
+ }
683
+ return [4 /*yield*/, auth._getAppCheckToken()];
684
+ case 1:
685
+ appCheckToken = _e.sent();
686
+ appCheckTokenFragment = appCheckToken
687
+ ? "#".concat(FIREBASE_APP_CHECK_FRAGMENT_ID, "=").concat(encodeURIComponent(appCheckToken))
688
+ : '';
689
+ // Start at index 1 to skip the leading '&' in the query string
690
+ return [2 /*return*/, "".concat(getHandlerBase(auth), "?").concat(util.querystring(paramsDict).slice(1)).concat(appCheckTokenFragment)];
691
+ }
692
+ });
693
+ });
675
694
  }
676
695
  function getHandlerBase(_a) {
677
696
  var config = _a.config;