@webex/plugin-authorization-browser-first-party 3.12.0 → 3.13.0-next.10

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.
package/README.md CHANGED
@@ -12,6 +12,7 @@
12
12
  - [When To Use This Package](#when-to-use-this-package)
13
13
  - [Key Features](#key-features)
14
14
  - [Basic Usage](#basic-usage)
15
+ - [Public Client with PKCE](#public-client-with-pkce)
15
16
  - [Standard Login (Authorization Code + PKCE)](#standard-login-authorization-code--pkce)
16
17
  - [Popup / Separate Window Login](#popup--separate-window-login)
17
18
  - [Device Authorization (QR Code Login)](#device-authorization-qr-code-login)
@@ -96,6 +97,37 @@ webex.authorization.initiateLogin({
96
97
  });
97
98
  ```
98
99
 
100
+ ### Public Client with PKCE
101
+
102
+ To use a public OAuth client, set `clientType` to `public` and omit
103
+ `client_secret`:
104
+
105
+ ```javascript
106
+ const publicClientWebex = Webex.init({
107
+ credentials: {
108
+ clientType: 'public',
109
+ client_id: 'first-party-public-client-id',
110
+ redirect_uri: 'https://web.webex.com/auth/callback',
111
+ scope: 'spark:all'
112
+ }
113
+ });
114
+
115
+ publicClientWebex.authorization.initiateLogin({
116
+ email: 'user@example.com',
117
+ state: { returnTo: '/home' }
118
+ });
119
+ ```
120
+
121
+ The authorization-code exchange and token refresh requests send `client_id`
122
+ in the form without HTTP Basic client authentication.
123
+
124
+ For an existing confidential client, set `clientType` to `confidential` and
125
+ provide both `client_id` and `client_secret`. The plugin continues to use HTTP
126
+ Basic client authentication for authorization-code exchange and token refresh.
127
+
128
+ Public-client device authorization and token revocation are not changed by
129
+ this support.
130
+
99
131
  ### Standard Login (Authorization Code + PKCE)
100
132
 
101
133
  1. `initiateLogin()` creates:
@@ -178,13 +210,44 @@ webex.authorization.initQRCodeLogin();
178
210
 
179
211
  ### Properties
180
212
 
181
- | Property | Type | Description |
182
- | ------------------ | ---------------- | --------------------------------------------------------- |
183
- | `isAuthorizing` | boolean | True while a grant request is in flight |
184
- | `isAuthenticating` | boolean | Alias of `isAuthorizing` |
185
- | `ready` | boolean | Set true after initial redirect/code processing completes |
186
- | `eventEmitter` | EventEmitter | Emits QR/Device login lifecycle events |
187
- | `Events` | enum-like object | Accessible names for event types |
213
+ | Property | Type | Description |
214
+ | -------------------------------------- | ---------------- | --------------------------------------------------------- |
215
+ | `initialAuthorizationCodeGrantOutcome` | string | Retained outcome of the automatic initialization exchange |
216
+ | `isAuthorizing` | boolean | True while a grant request is in flight |
217
+ | `isAuthenticating` | boolean | Alias of `isAuthorizing` |
218
+ | `ready` | boolean | Set true after initial redirect/code processing completes |
219
+ | `eventEmitter` | EventEmitter | Emits QR/Device login lifecycle events |
220
+ | `Events` | enum-like object | Accessible names for event types |
221
+
222
+ #### Initial authorization-code grant outcome
223
+
224
+ ```javascript
225
+ import {InitialAuthorizationCodeGrantOutcomes} from '@webex/plugin-authorization-browser-first-party';
226
+
227
+ const didInitialExchangeSucceed =
228
+ webex.authorization.initialAuthorizationCodeGrantOutcome ===
229
+ InitialAuthorizationCodeGrantOutcomes.success;
230
+ ```
231
+
232
+ `initialAuthorizationCodeGrantOutcome` describes only the automatic
233
+ `requestAuthorizationCodeGrant()` call made while this authorization plugin
234
+ instance initializes. Read it after `ready`:
235
+
236
+ - `not_attempted`: initialization did not invoke the exchange.
237
+ - `success`: the initialization exchange fulfilled.
238
+ - `failure`: the initialization exchange threw or rejected.
239
+
240
+ The value is a historical result retained for the lifetime of the SDK instance
241
+ and is not reset by logout. It does not represent current authorization state
242
+ or credentials hydrated from storage. It also does not track guest or device
243
+ authentication, token refreshes, or authorization-code exchanges requested
244
+ later on the same SDK instance.
245
+
246
+ OAuth redirect errors and CSRF validation failures occur before the exchange,
247
+ so the value remains `not_attempted`; these errors can throw before `ready`
248
+ becomes `true`. A non-redirecting logout does not cancel an initialization
249
+ exchange already in flight. If that exchange later settles, it can still update
250
+ credentials and this retained outcome.
188
251
 
189
252
  ## Security Considerations
190
253
 
@@ -1,23 +1,30 @@
1
1
  "use strict";
2
2
 
3
+ var _Object$keys = require("@babel/runtime-corejs2/core-js/object/keys");
4
+ var _Object$getOwnPropertySymbols = require("@babel/runtime-corejs2/core-js/object/get-own-property-symbols");
5
+ var _Object$getOwnPropertyDescriptor2 = require("@babel/runtime-corejs2/core-js/object/get-own-property-descriptor");
6
+ var _Object$getOwnPropertyDescriptors = require("@babel/runtime-corejs2/core-js/object/get-own-property-descriptors");
7
+ var _Object$defineProperties = require("@babel/runtime-corejs2/core-js/object/define-properties");
3
8
  var _Object$defineProperty = require("@babel/runtime-corejs2/core-js/object/define-property");
4
9
  var _interopRequireDefault = require("@babel/runtime-corejs2/helpers/interopRequireDefault");
5
10
  _Object$defineProperty(exports, "__esModule", {
6
11
  value: true
7
12
  });
8
- exports.default = exports.Events = void 0;
13
+ exports.default = exports.InitialAuthorizationCodeGrantOutcomes = exports.Events = void 0;
14
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/defineProperty"));
15
+ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/objectWithoutProperties"));
9
16
  var _apply = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/reflect/apply"));
10
17
  var _promise = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/promise"));
11
18
  var _assign = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/object/assign"));
12
19
  var _entries = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/object/entries"));
13
20
  var _deleteProperty = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/reflect/delete-property"));
14
- var _stringify = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/json/stringify"));
21
+ var _from = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/array/from"));
15
22
  var _getOwnPropertyDescriptor = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/object/get-own-property-descriptor"));
16
23
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/slicedToArray"));
17
24
  var _typeof2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/typeof"));
18
25
  var _applyDecoratedDescriptor2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/applyDecoratedDescriptor"));
19
26
  var _querystring = _interopRequireDefault(require("querystring"));
20
- var _url = _interopRequireDefault(require("url"));
27
+ var _url2 = _interopRequireDefault(require("url"));
21
28
  var _events = require("events");
22
29
  var _common = require("@webex/common");
23
30
  var _webexCore = require("@webex/webex-core");
@@ -25,6 +32,9 @@ var _lodash = require("lodash");
25
32
  var _uuid = _interopRequireDefault(require("uuid"));
26
33
  var _encBase64url = _interopRequireDefault(require("crypto-js/enc-base64url"));
27
34
  var _cryptoJs = _interopRequireDefault(require("crypto-js"));
35
+ var _config = require("./config");
36
+ var _excluded = ["csrf_token"],
37
+ _excluded2 = ["form"];
28
38
  var _dec, _dec2, _obj; // @ts-nocheck
29
39
  /* eslint-disable */
30
40
  /*!
@@ -35,9 +45,8 @@ var _dec, _dec2, _obj; // @ts-nocheck
35
45
  * TS checking disabled: file uses legacy decorator syntax inside an object literal
36
46
  * transformed by Babel. Safe to ignore for now.
37
47
  */
38
- // Necessary to require lodash this way in order to stub
39
- // methods in the unit test
40
- var lodash = require('lodash');
48
+ function ownKeys(e, r) { var t = _Object$keys(e); if (_Object$getOwnPropertySymbols) { var o = _Object$getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return _Object$getOwnPropertyDescriptor2(e, r).enumerable; })), t.push.apply(t, o); } return t; }
49
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor2(t, r)); }); } return e; }
41
50
  var OAUTH2_CSRF_TOKEN = 'oauth2-csrf-token';
42
51
  var OAUTH2_CODE_VERIFIER = 'oauth2-code-verifier';
43
52
 
@@ -52,6 +61,18 @@ var Events = exports.Events = {
52
61
  qRCodeLogin: 'qRCodeLogin'
53
62
  };
54
63
 
64
+ /**
65
+ * Terminal outcomes for the automatic authorization-code exchange performed
66
+ * during authorization plugin initialization.
67
+ *
68
+ * @enum {string}
69
+ */
70
+ var InitialAuthorizationCodeGrantOutcomes = exports.InitialAuthorizationCodeGrantOutcomes = {
71
+ failure: 'failure',
72
+ notAttempted: 'not_attempted',
73
+ success: 'success'
74
+ };
75
+
55
76
  /**
56
77
  * Browser support for OAuth2 for first-party (Webex Web Client) usage.
57
78
  *
@@ -82,6 +103,37 @@ var Events = exports.Events = {
82
103
  */
83
104
  var Authorization = _webexCore.WebexPlugin.extend((_dec = (0, _common.whileInFlight)('isAuthorizing'), _dec2 = (0, _common.whileInFlight)('isAuthorizing'), _obj = {
84
105
  derived: {
106
+ /**
107
+ * Retains the terminal outcome of the automatic authorization-code exchange
108
+ * performed during this authorization plugin instance's initialization.
109
+ *
110
+ * This historical value does not represent current authorization state,
111
+ * credentials hydrated from storage, guest authentication, or
112
+ * authorization-code exchanges requested later on the same SDK instance. It
113
+ * is not reset by logout. OAuth redirect errors and CSRF validation failures
114
+ * occur before the exchange, so the value remains not_attempted; these errors
115
+ * can throw before ready becomes true.
116
+ *
117
+ * Calling logout({noRedirect: true}) does not cancel an initialization
118
+ * exchange already in flight. If that exchange later settles, it can still
119
+ * update credentials and this retained outcome.
120
+ *
121
+ * Interpret only after authorization readiness:
122
+ * - not_attempted: initialization did not invoke requestAuthorizationCodeGrant()
123
+ * - success: the initialization exchange fulfilled
124
+ * - failure: the initialization exchange threw or rejected
125
+ *
126
+ * @instance
127
+ * @memberof AuthorizationBrowserFirstParty
128
+ * @readonly
129
+ * @type {string}
130
+ */
131
+ initialAuthorizationCodeGrantOutcome: {
132
+ deps: ['_initialAuthorizationCodeGrantOutcome'],
133
+ fn: function fn() {
134
+ return this._initialAuthorizationCodeGrantOutcome;
135
+ }
136
+ },
85
137
  /**
86
138
  * Alias of {@link AuthorizationBrowserFirstParty#isAuthorizing}
87
139
  * @instance
@@ -106,6 +158,14 @@ var Authorization = _webexCore.WebexPlugin.extend((_dec = (0, _common.whileInFli
106
158
  default: false,
107
159
  type: 'boolean'
108
160
  },
161
+ /**
162
+ * Internal backing state for the initial authorization-code grant outcome.
163
+ * @private
164
+ */
165
+ _initialAuthorizationCodeGrantOutcome: {
166
+ default: InitialAuthorizationCodeGrantOutcomes.notAttempted,
167
+ type: 'string'
168
+ },
109
169
  /**
110
170
  * Indicates that the plugin has finished any automatic startup
111
171
  * processing (e.g., exchanging a returned authorization code)
@@ -194,7 +254,7 @@ var Authorization = _webexCore.WebexPlugin.extend((_dec = (0, _common.whileInFli
194
254
  attrs[_key] = arguments[_key];
195
255
  }
196
256
  var ret = (0, _apply.default)(_webexCore.WebexPlugin.prototype.initialize, this, attrs);
197
- var location = _url.default.parse(this.webex.getWindow().location.href, true);
257
+ var location = _url2.default.parse(this.webex.getWindow().location.href, true);
198
258
 
199
259
  // Check if redirect includes error
200
260
  this._checkForErrors(location);
@@ -208,7 +268,7 @@ var Authorization = _webexCore.WebexPlugin.extend((_dec = (0, _common.whileInFli
208
268
 
209
269
  // Decode and parse state object (if present)
210
270
  if (location.query.state) {
211
- location.query.state = JSON.parse(_common.base64.decode(location.query.state));
271
+ location.query.state = (0, _common.decodeState)(location.query.state);
212
272
  } else {
213
273
  location.query.state = {};
214
274
  }
@@ -247,7 +307,10 @@ var Authorization = _webexCore.WebexPlugin.extend((_dec = (0, _common.whileInFli
247
307
  code: code,
248
308
  codeVerifier: codeVerifier
249
309
  });
310
+ }).then(function () {
311
+ _this._initialAuthorizationCodeGrantOutcome = InitialAuthorizationCodeGrantOutcomes.success;
250
312
  }).catch(function (error) {
313
+ _this._initialAuthorizationCodeGrantOutcome = InitialAuthorizationCodeGrantOutcomes.failure;
251
314
  _this.logger.warn('authorization: failed initial authorization code grant request', error);
252
315
  }).then(function () {
253
316
  // Mark plugin ready regardless of success/failure of token exchange
@@ -347,6 +410,94 @@ var Authorization = _webexCore.WebexPlugin.extend((_dec = (0, _common.whileInFli
347
410
  }
348
411
  return _promise.default.resolve();
349
412
  },
413
+ /**
414
+ * Initiates third-party (social provider) login. Generates a CSRF token,
415
+ * embeds it in `options.state.csrf_token`, and delegates to
416
+ * `initiateThirdPartyLoginRedirect` for navigation.
417
+ *
418
+ * @instance
419
+ * @memberof AuthorizationBrowserFirstParty
420
+ * @param {Object} options
421
+ * @param {string} options.oauth2provider
422
+ * @param {string} options.returnURL
423
+ * @param {Object} [options.state] - Caller-supplied state object. Merged
424
+ * with the generated `csrf_token`.
425
+ * @returns {Promise<void>}
426
+ */
427
+ initiateThirdPartyLogin: function initiateThirdPartyLogin() {
428
+ var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
429
+ options = (0, _lodash.cloneDeep)(options);
430
+ if (options.state !== undefined && !(0, _lodash.isObject)(options.state)) {
431
+ throw new Error('if specified, `options.state` must be an object');
432
+ }
433
+ options.state = options.state || {};
434
+ options.state.csrf_token = this._generateSecurityToken();
435
+ return this.initiateThirdPartyLoginRedirect(options);
436
+ },
437
+ /**
438
+ * Performs the navigation step of the third-party login flow. Builds the
439
+ * IdBroker URL via `Credentials#buildThirdPartyLoginUrl` and assigns it
440
+ * to `getWindow().location`.
441
+ *
442
+ * Mirrors `initiateAuthorizationCodeGrant` for the `/authorize` flow.
443
+ * Consumers may override this method for custom navigation handling
444
+ * (e.g. postMessage in iframed contexts).
445
+ *
446
+ * @instance
447
+ * @memberof AuthorizationBrowserFirstParty
448
+ * @param {Object} options
449
+ * @param {string} options.oauth2provider
450
+ * @param {string} options.returnURL
451
+ * @returns {Promise<void>}
452
+ */
453
+ initiateThirdPartyLoginRedirect: function initiateThirdPartyLoginRedirect() {
454
+ var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
455
+ this.logger.info('authorization: initiating third-party login redirect');
456
+ try {
457
+ var _url = this.webex.credentials.buildThirdPartyLoginUrl(options);
458
+ this.webex.getWindow().location = _url;
459
+ } catch (err) {
460
+ return _promise.default.reject(err);
461
+ }
462
+ return _promise.default.resolve();
463
+ },
464
+ /**
465
+ * Handles the third-party (social provider) login callback. Reads the
466
+ * current `window.location`, decodes `state`, validates the CSRF token
467
+ * (`state.csrf_token`), scrubs sensitive parameters from the URL via
468
+ * `_cleanUrl`, and returns the parsed payload.
469
+ *
470
+ * Mirrors `initialize()` in always operating on the live
471
+ * `window.location`
472
+ *
473
+ * `idToken` is single-use: it is parsed out of the URL exactly once and
474
+ * the calling client is expected to exchange it (or discard it)
475
+ * immediately. The returned `state` has `csrf_token` removed.
476
+ *
477
+ * @instance
478
+ * @memberof AuthorizationBrowserFirstParty
479
+ * @returns {{idToken: string|undefined, email: string|undefined,
480
+ * error: string|undefined, state: Object}}
481
+ */
482
+ handleThirdPartyCallback: function handleThirdPartyCallback() {
483
+ var location = _url2.default.parse(this.webex.getWindow().location.href, true);
484
+ location.query.state = (0, _common.decodeState)(location.query.state || 'e30');
485
+ this._verifySecurityToken(location.query);
486
+ this._cleanUrl(location);
487
+ var _location$query = location.query,
488
+ idToken = _location$query.id_token,
489
+ email = _location$query.email,
490
+ error = _location$query.error,
491
+ _location$query$state = _location$query.state,
492
+ csrf_token = _location$query$state.csrf_token,
493
+ state = (0, _objectWithoutProperties2.default)(_location$query$state, _excluded);
494
+ return {
495
+ idToken: idToken,
496
+ email: email,
497
+ error: error,
498
+ state: state
499
+ };
500
+ },
350
501
  /**
351
502
  * Called by {@link WebexCore#logout()}.
352
503
  * Constructs logout URL and (unless suppressed) navigates away to ensure
@@ -400,17 +551,17 @@ var Authorization = _webexCore.WebexPlugin.extend((_dec = (0, _common.whileInFli
400
551
  if (options.codeVerifier) {
401
552
  form.code_verifier = options.codeVerifier;
402
553
  }
403
- return this.webex.request({
554
+ var _getClientAuthenticat = (0, _config.getClientAuthenticationOptions)(this.config),
555
+ _getClientAuthenticat2 = _getClientAuthenticat.form,
556
+ clientForm = _getClientAuthenticat2 === void 0 ? {} : _getClientAuthenticat2,
557
+ clientAuthentication = (0, _objectWithoutProperties2.default)(_getClientAuthenticat, _excluded2);
558
+ return this.webex.request(_objectSpread(_objectSpread({
404
559
  method: 'POST',
405
560
  uri: this.config.tokenUrl,
406
- form: form,
407
- auth: {
408
- user: this.config.client_id,
409
- pass: this.config.client_secret,
410
- sendImmediately: true
411
- },
561
+ form: _objectSpread(_objectSpread({}, form), clientForm)
562
+ }, clientAuthentication), {}, {
412
563
  shouldRefreshAccessToken: false // This is the token acquisition call itself
413
- }).then(function (res) {
564
+ })).then(function (res) {
414
565
  // Store supertoken into credentials (includes refresh token)
415
566
  _this2.webex.credentials.set({
416
567
  supertoken: res.body
@@ -696,8 +847,9 @@ var Authorization = _webexCore.WebexPlugin.extend((_dec = (0, _common.whileInFli
696
847
  * - HTTP referrer headers to third-party content
697
848
  *
698
849
  * Approach:
699
- * - Remove 'code'.
700
- * - Remove 'state' entirely if only contained csrf_token.
850
+ * - Remove 'code' (OAuth code-grant), 'id_token', and 'email'
851
+ * (third-party callback).
852
+ * - Remove 'state' entirely if it only contained csrf_token.
701
853
  * - Else, re-encode remaining state fields (minus csrf_token).
702
854
  * - Replace current history entry (no page reload).
703
855
  *
@@ -711,14 +863,16 @@ var Authorization = _webexCore.WebexPlugin.extend((_dec = (0, _common.whileInFli
711
863
  location = (0, _lodash.cloneDeep)(location);
712
864
  if (this.webex.getWindow().history && this.webex.getWindow().history.replaceState) {
713
865
  (0, _deleteProperty.default)(location.query, 'code');
866
+ (0, _deleteProperty.default)(location.query, 'id_token');
867
+ (0, _deleteProperty.default)(location.query, 'email');
714
868
  if ((0, _lodash.isEmpty)((0, _lodash.omit)(location.query.state, 'csrf_token'))) {
715
869
  (0, _deleteProperty.default)(location.query, 'state');
716
870
  } else {
717
- location.query.state = _common.base64.encode((0, _stringify.default)((0, _lodash.omit)(location.query.state, 'csrf_token')));
871
+ location.query.state = (0, _common.encodeState)((0, _lodash.omit)(location.query.state, 'csrf_token'));
718
872
  }
719
873
  location.search = _querystring.default.stringify(location.query);
720
874
  (0, _deleteProperty.default)(location, 'query');
721
- this.webex.getWindow().history.replaceState({}, null, _url.default.format(location));
875
+ this.webex.getWindow().history.replaceState({}, null, _url2.default.format(location));
722
876
  }
723
877
  },
724
878
  /**
@@ -727,7 +881,8 @@ var Authorization = _webexCore.WebexPlugin.extend((_dec = (0, _common.whileInFli
727
881
  * during authorization code exchange; removes it once consumed.
728
882
  *
729
883
  * Implementation details:
730
- * - Creates a 128 character string using base64url safe alphabet.
884
+ * - Creates a 128 character string using a cryptographically secure random
885
+ * source and the base64url safe alphabet.
731
886
  * - Computes SHA256 hash, encodes to base64url (no padding).
732
887
  *
733
888
  * @instance
@@ -740,8 +895,10 @@ var Authorization = _webexCore.WebexPlugin.extend((_dec = (0, _common.whileInFli
740
895
 
741
896
  // eslint-disable-next-line no-underscore-dangle
742
897
  var safeCharacterMap = _encBase64url.default._safe_map;
743
- var codeVerifier = lodash.times(128, function () {
744
- return safeCharacterMap[lodash.random(0, safeCharacterMap.length - 1)];
898
+ var randomValues = new Uint8Array(128);
899
+ this.webex.getWindow().crypto.getRandomValues(randomValues);
900
+ var codeVerifier = (0, _from.default)(randomValues, function (randomValue) {
901
+ return safeCharacterMap[randomValue & safeCharacterMap.length - 1];
745
902
  }).join('');
746
903
  var codeChallenge = _cryptoJs.default.SHA256(codeVerifier).toString(_encBase64url.default);
747
904
  this.webex.getWindow().sessionStorage.setItem(OAUTH2_CODE_VERIFIER, codeVerifier);
@@ -773,7 +930,7 @@ var Authorization = _webexCore.WebexPlugin.extend((_dec = (0, _common.whileInFli
773
930
  * - Ensure state + state.csrf_token exist.
774
931
  * - Compare values; throw descriptive errors on mismatch / absence.
775
932
  *
776
- * If no stored token (e.g., user navigated directly), silently returns.
933
+ * If no stored token exists, treats the callback as a CSRF failure.
777
934
  *
778
935
  * @instance
779
936
  * @memberof AuthorizationBrowserFirstParty
@@ -782,15 +939,13 @@ var Authorization = _webexCore.WebexPlugin.extend((_dec = (0, _common.whileInFli
782
939
  * @returns {void}
783
940
  */
784
941
  _verifySecurityToken: function _verifySecurityToken(query) {
942
+ var _query$state;
785
943
  var sessionToken = this.webex.getWindow().sessionStorage.getItem(OAUTH2_CSRF_TOKEN);
786
944
  this.webex.getWindow().sessionStorage.removeItem(OAUTH2_CSRF_TOKEN);
787
945
  if (!sessionToken) {
788
- return;
789
- }
790
- if (!query.state) {
791
- throw new Error("Expected CSRF token ".concat(sessionToken, ", but not found in redirect query"));
946
+ throw new Error('CSRF token missing from session storage');
792
947
  }
793
- if (!query.state.csrf_token) {
948
+ if (!((_query$state = query.state) !== null && _query$state !== void 0 && _query$state.csrf_token)) {
794
949
  throw new Error("Expected CSRF token ".concat(sessionToken, ", but not found in redirect query"));
795
950
  }
796
951
  var token = query.state.csrf_token;
@@ -798,7 +953,7 @@ var Authorization = _webexCore.WebexPlugin.extend((_dec = (0, _common.whileInFli
798
953
  throw new Error("CSRF token ".concat(token, " does not match stored token ").concat(sessionToken));
799
954
  }
800
955
  },
801
- version: "3.12.0"
956
+ version: "3.13.0-next.10"
802
957
  }, (0, _applyDecoratedDescriptor2.default)(_obj, "initiateAuthorizationCodeGrant", [_dec], (0, _getOwnPropertyDescriptor.default)(_obj, "initiateAuthorizationCodeGrant"), _obj), (0, _applyDecoratedDescriptor2.default)(_obj, "requestAuthorizationCodeGrant", [_dec2, _common.oneFlight], (0, _getOwnPropertyDescriptor.default)(_obj, "requestAuthorizationCodeGrant"), _obj), _obj));
803
958
  var _default = exports.default = Authorization;
804
959
  //# sourceMappingURL=authorization.js.map