@opencampus/ocid-connect-js 1.2.1 → 1.2.2
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 +14 -5
- package/dist/ocid-connect-js.js +137 -94
- package/dist/ocid-connect-js.js.map +1 -1
- package/lib/react/LoginCallBack.js +9 -24
- package/lib/react/OCConnect.js +37 -18
- package/lib/sdk/auth.js +20 -14
- package/lib/sdk/lib/AuthInfoManager.js +31 -19
- package/lib/sdk/lib/TokenManager.js +40 -21
- package/package.json +5 -3
package/README.md
CHANGED
|
@@ -110,7 +110,7 @@ Use useOCAuth hook to read credentials info
|
|
|
110
110
|
import { useOCAuth } from '@opencampus/ocid-connect-js';
|
|
111
111
|
|
|
112
112
|
const UserTokenPage = (props) => {
|
|
113
|
-
const { authState, ocAuth } = useOCAuth();
|
|
113
|
+
const { authState, ocAuth, OCId, ethAddress } = useOCAuth();
|
|
114
114
|
|
|
115
115
|
if (authState.error !== undefined) {
|
|
116
116
|
return <div>Error: {authState.error.message}</div>;
|
|
@@ -119,8 +119,10 @@ const UserTokenPage = (props) => {
|
|
|
119
119
|
<div>
|
|
120
120
|
<h4>User Info</h4>
|
|
121
121
|
<pre>
|
|
122
|
-
{ JSON.stringify(ocAuth.
|
|
122
|
+
{ JSON.stringify(ocAuth.getAuthState(), null, 2) }
|
|
123
123
|
</pre>
|
|
124
|
+
<pre>{OCId}</pre>
|
|
125
|
+
<pre>{ethAddress}</pre>
|
|
124
126
|
</div>
|
|
125
127
|
);
|
|
126
128
|
}
|
|
@@ -298,7 +300,7 @@ export default function Home() {
|
|
|
298
300
|
<div>
|
|
299
301
|
<h1>Welcome to My App</h1>
|
|
300
302
|
{authState.isAuthenticated ? (
|
|
301
|
-
<p>You are logged in! {JSON.stringify(ocAuth.
|
|
303
|
+
<p>You are logged in! {JSON.stringify(ocAuth.getAuthState())}</p>
|
|
302
304
|
|
|
303
305
|
) : (
|
|
304
306
|
<LoginButton />
|
|
@@ -328,8 +330,8 @@ Main Methods of Auth SDK
|
|
|
328
330
|
| --- | --- |
|
|
329
331
|
| signInWithRedirect | Initialize login process. Accept "state" as an input |
|
|
330
332
|
| handleLoginRedirect | Return the auth state of the login process |
|
|
331
|
-
|
|
|
332
|
-
|
|
|
333
|
+
| getAuthState | Return auth state data { accessToken, idToken, OCId, ethAddress, isAuthenticated } |
|
|
334
|
+
| getStateParameter() | Return the state that was initialized in signin process |
|
|
333
335
|
|
|
334
336
|
Sample usage
|
|
335
337
|
|
|
@@ -369,5 +371,12 @@ try {
|
|
|
369
371
|
}
|
|
370
372
|
```
|
|
371
373
|
|
|
374
|
+
Access OCId info of Auth SDK
|
|
375
|
+
|
|
376
|
+
| property | Description |
|
|
377
|
+
| --- | --- |
|
|
378
|
+
| OCId | return OC ID |
|
|
379
|
+
| ethAddress | Return eth Wallet Address that connect to the ID |
|
|
380
|
+
|
|
372
381
|
### License
|
|
373
382
|
ocid-connect-js is released under the MIT license.
|
package/dist/ocid-connect-js.js
CHANGED
|
@@ -360,51 +360,36 @@ var LoginCallBack = function LoginCallBack(_ref) {
|
|
|
360
360
|
var _useOCAuth = Object(_OCContext__WEBPACK_IMPORTED_MODULE_1__["useOCAuth"])(),
|
|
361
361
|
ocAuth = _useOCAuth.ocAuth,
|
|
362
362
|
authState = _useOCAuth.authState,
|
|
363
|
-
|
|
363
|
+
setAuthError = _useOCAuth.setAuthError;
|
|
364
364
|
Object(react__WEBPACK_IMPORTED_MODULE_0__["useEffect"])(function () {
|
|
365
365
|
var handleLogin = /*#__PURE__*/function () {
|
|
366
366
|
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
367
|
-
var _authState;
|
|
368
367
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
369
368
|
while (1) switch (_context.prev = _context.next) {
|
|
370
369
|
case 0:
|
|
371
370
|
if (!ocAuth) {
|
|
372
|
-
_context.next =
|
|
371
|
+
_context.next = 11;
|
|
373
372
|
break;
|
|
374
373
|
}
|
|
375
374
|
_context.prev = 1;
|
|
376
375
|
_context.next = 4;
|
|
377
376
|
return ocAuth.handleLoginRedirect();
|
|
378
377
|
case 4:
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
updateAuthState(_authState);
|
|
382
|
-
handledRedirect = true;
|
|
383
|
-
successCallback();
|
|
384
|
-
} else {
|
|
385
|
-
updateAuthState({
|
|
386
|
-
error: 'missing idToken from redirect callback'
|
|
387
|
-
});
|
|
388
|
-
if (errorCallback) {
|
|
389
|
-
errorCallback();
|
|
390
|
-
}
|
|
391
|
-
}
|
|
392
|
-
_context.next = 12;
|
|
378
|
+
successCallback();
|
|
379
|
+
_context.next = 11;
|
|
393
380
|
break;
|
|
394
|
-
case
|
|
395
|
-
_context.prev =
|
|
381
|
+
case 7:
|
|
382
|
+
_context.prev = 7;
|
|
396
383
|
_context.t0 = _context["catch"](1);
|
|
397
|
-
|
|
398
|
-
error: _context.t0
|
|
399
|
-
});
|
|
384
|
+
setAuthError(_context.t0);
|
|
400
385
|
if (errorCallback) {
|
|
401
386
|
errorCallback();
|
|
402
387
|
}
|
|
403
|
-
case
|
|
388
|
+
case 11:
|
|
404
389
|
case "end":
|
|
405
390
|
return _context.stop();
|
|
406
391
|
}
|
|
407
|
-
}, _callee, null, [[1,
|
|
392
|
+
}, _callee, null, [[1, 7]]);
|
|
408
393
|
}));
|
|
409
394
|
return function handleLogin() {
|
|
410
395
|
return _ref2.apply(this, arguments);
|
|
@@ -458,34 +443,53 @@ var OCConnect = function OCConnect(_ref) {
|
|
|
458
443
|
_useState2 = _slicedToArray(_useState, 2),
|
|
459
444
|
ocAuth = _useState2[0],
|
|
460
445
|
setOcAuth = _useState2[1];
|
|
461
|
-
var _useState3 = Object(react__WEBPACK_IMPORTED_MODULE_0__["useState"])(
|
|
446
|
+
var _useState3 = Object(react__WEBPACK_IMPORTED_MODULE_0__["useState"])(),
|
|
447
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
448
|
+
OCId = _useState4[0],
|
|
449
|
+
setOCId = _useState4[1];
|
|
450
|
+
var _useState5 = Object(react__WEBPACK_IMPORTED_MODULE_0__["useState"])(),
|
|
451
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
452
|
+
ethAddress = _useState6[0],
|
|
453
|
+
setEthAddress = _useState6[1];
|
|
454
|
+
var _useState7 = Object(react__WEBPACK_IMPORTED_MODULE_0__["useState"])({
|
|
462
455
|
isAuthenticated: false
|
|
463
456
|
}),
|
|
464
|
-
|
|
465
|
-
authState =
|
|
466
|
-
setAuthState =
|
|
457
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
458
|
+
authState = _useState8[0],
|
|
459
|
+
setAuthState = _useState8[1];
|
|
460
|
+
var _useState9 = Object(react__WEBPACK_IMPORTED_MODULE_0__["useState"])(null),
|
|
461
|
+
_useState10 = _slicedToArray(_useState9, 2),
|
|
462
|
+
authError = _useState10[0],
|
|
463
|
+
setAuthError = _useState10[1];
|
|
464
|
+
var updateAuthState = function updateAuthState(authState) {
|
|
465
|
+
setAuthState(authState);
|
|
466
|
+
setOCId(authState.OCId);
|
|
467
|
+
setEthAddress(authState.ethAddress);
|
|
468
|
+
};
|
|
469
|
+
|
|
470
|
+
// init sdk
|
|
467
471
|
Object(react__WEBPACK_IMPORTED_MODULE_0__["useEffect"])(function () {
|
|
468
472
|
var authSdk = sandboxMode ? new _sdk_auth__WEBPACK_IMPORTED_MODULE_2__["OCAuthSandbox"](opts) : new _sdk_auth__WEBPACK_IMPORTED_MODULE_2__["OCAuthLive"](opts);
|
|
469
|
-
setOcAuth(authSdk);
|
|
470
473
|
updateAuthState(authSdk.getAuthState());
|
|
474
|
+
setOcAuth(authSdk);
|
|
471
475
|
}, []);
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
error: error
|
|
482
|
-
});
|
|
483
|
-
};
|
|
476
|
+
Object(react__WEBPACK_IMPORTED_MODULE_0__["useEffect"])(function () {
|
|
477
|
+
if (ocAuth.authInfoManager) {
|
|
478
|
+
// reactively recieve update on the authstate change
|
|
479
|
+
ocAuth.authInfoManager.subscribe(updateAuthState);
|
|
480
|
+
return function () {
|
|
481
|
+
ocAuth.authInfoManager.unsubscribe(updateAuthState);
|
|
482
|
+
};
|
|
483
|
+
}
|
|
484
|
+
}, [ocAuth]);
|
|
484
485
|
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_OCContext__WEBPACK_IMPORTED_MODULE_1__["OCContext"].Provider, {
|
|
485
486
|
value: {
|
|
487
|
+
OCId: OCId,
|
|
488
|
+
ethAddress: ethAddress,
|
|
486
489
|
ocAuth: ocAuth,
|
|
487
490
|
authState: authState,
|
|
488
|
-
|
|
491
|
+
authError: authError,
|
|
492
|
+
setAuthError: setAuthError
|
|
489
493
|
}
|
|
490
494
|
}, children);
|
|
491
495
|
};
|
|
@@ -639,7 +643,7 @@ var OCAuthCore = /*#__PURE__*/function () {
|
|
|
639
643
|
break;
|
|
640
644
|
}
|
|
641
645
|
_context3.next = 7;
|
|
642
|
-
return this.tokenManager.exchangeTokenFromCode(urlParams.code, codeVerifier);
|
|
646
|
+
return this.tokenManager.exchangeTokenFromCode(urlParams.code, codeVerifier, urlParams.state);
|
|
643
647
|
case 7:
|
|
644
648
|
// clear transaction meta, coz it's completed
|
|
645
649
|
this.transactionManager.clear();
|
|
@@ -675,26 +679,18 @@ var OCAuthCore = /*#__PURE__*/function () {
|
|
|
675
679
|
var _this$getParsedIdToke = this.getParsedIdToken(),
|
|
676
680
|
edu_username = _this$getParsedIdToke.edu_username,
|
|
677
681
|
eth_address = _this$getParsedIdToke.eth_address;
|
|
678
|
-
this.authInfoManager.
|
|
679
|
-
edu_username: edu_username,
|
|
680
|
-
eth_address: eth_address
|
|
681
|
-
});
|
|
682
|
+
this.authInfoManager.setAuthState(this.getAccessToken(), this.getIdToken(), edu_username, eth_address, this.isAuthenticated());
|
|
682
683
|
}
|
|
683
684
|
}
|
|
684
685
|
}, {
|
|
685
686
|
key: "getAuthState",
|
|
686
687
|
value: function getAuthState() {
|
|
687
|
-
|
|
688
|
-
accessToken: this.getAccessToken(),
|
|
689
|
-
idToken: this.getIdToken(),
|
|
690
|
-
isAuthenticated: this.isAuthenticated()
|
|
691
|
-
};
|
|
692
|
-
return authState;
|
|
688
|
+
return this.authInfoManager.getAuthState();
|
|
693
689
|
}
|
|
694
690
|
}, {
|
|
695
|
-
key: "
|
|
696
|
-
value: function
|
|
697
|
-
return this.
|
|
691
|
+
key: "getStateParameter",
|
|
692
|
+
value: function getStateParameter() {
|
|
693
|
+
return this.tokenManager.getStateParameter();
|
|
698
694
|
}
|
|
699
695
|
}, {
|
|
700
696
|
key: "getIdToken",
|
|
@@ -726,6 +722,20 @@ var OCAuthCore = /*#__PURE__*/function () {
|
|
|
726
722
|
}
|
|
727
723
|
return {};
|
|
728
724
|
}
|
|
725
|
+
}, {
|
|
726
|
+
key: "OCId",
|
|
727
|
+
get: function get() {
|
|
728
|
+
var _info$OCId;
|
|
729
|
+
var info = this.authInfoManager.getAuthState();
|
|
730
|
+
return (_info$OCId = info.OCId) !== null && _info$OCId !== void 0 ? _info$OCId : null;
|
|
731
|
+
}
|
|
732
|
+
}, {
|
|
733
|
+
key: "ethAddress",
|
|
734
|
+
get: function get() {
|
|
735
|
+
var _info$ethAddress;
|
|
736
|
+
var info = this.authInfoManager.getAuthState();
|
|
737
|
+
return (_info$ethAddress = info.ethAddress) !== null && _info$ethAddress !== void 0 ? _info$ethAddress : null;
|
|
738
|
+
}
|
|
729
739
|
}]);
|
|
730
740
|
}();
|
|
731
741
|
var LIVE_PUBLIC_KEY = 'MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEBIDHtLbgVM76SXZ4iuIjuO+ERQPnVpJzagOsZdYxFG3ZJmvfdpr/Z29SLUbdZWafrOlAVlKe1Ovf/tcH671tTw==';
|
|
@@ -781,6 +791,7 @@ var OCAuthSandbox = /*#__PURE__*/function (_OCAuthCore3) {
|
|
|
781
791
|
|
|
782
792
|
"use strict";
|
|
783
793
|
__webpack_require__.r(__webpack_exports__);
|
|
794
|
+
!(function webpackMissingModule() { var e = new Error("Cannot find module 'tiny-emitter'"); e.code = 'MODULE_NOT_FOUND'; throw e; }());
|
|
784
795
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
785
796
|
function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
|
|
786
797
|
function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
|
|
@@ -797,35 +808,48 @@ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e
|
|
|
797
808
|
*
|
|
798
809
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
799
810
|
*/
|
|
811
|
+
|
|
812
|
+
|
|
813
|
+
var EVENT_AUTH_STATE_CHANGE = 'authStateChange';
|
|
800
814
|
var AuthInfoManager = /*#__PURE__*/function () {
|
|
801
815
|
function AuthInfoManager() {
|
|
802
816
|
_classCallCheck(this, AuthInfoManager);
|
|
803
|
-
_defineProperty(this, "
|
|
817
|
+
_defineProperty(this, "_emmitter", void 0);
|
|
818
|
+
_defineProperty(this, "_authState", void 0);
|
|
804
819
|
this._authState = null;
|
|
805
|
-
this.
|
|
820
|
+
this._emitter = new !(function webpackMissingModule() { var e = new Error("Cannot find module 'tiny-emitter'"); e.code = 'MODULE_NOT_FOUND'; throw e; }())();
|
|
806
821
|
}
|
|
807
822
|
return _createClass(AuthInfoManager, [{
|
|
808
|
-
key: "
|
|
809
|
-
value: function
|
|
810
|
-
this.
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
return this._idInfo[attribute];
|
|
823
|
+
key: "setAuthState",
|
|
824
|
+
value: function setAuthState(accessToken, idToken, OCId, ethAddress, isAuthenticated) {
|
|
825
|
+
this._authState = {
|
|
826
|
+
accessToken: accessToken,
|
|
827
|
+
idToken: idToken,
|
|
828
|
+
OCId: OCId,
|
|
829
|
+
ethAddress: ethAddress,
|
|
830
|
+
isAuthenticated: isAuthenticated
|
|
831
|
+
};
|
|
832
|
+
this._emitter.emit(EVENT_AUTH_STATE_CHANGE, this._authState);
|
|
819
833
|
}
|
|
820
834
|
}, {
|
|
821
|
-
key: "
|
|
822
|
-
value: function
|
|
823
|
-
return Object.assign({}, this.
|
|
835
|
+
key: "getAuthState",
|
|
836
|
+
value: function getAuthState() {
|
|
837
|
+
return Object.assign({}, this._authState);
|
|
824
838
|
}
|
|
825
839
|
}, {
|
|
826
840
|
key: "clear",
|
|
827
841
|
value: function clear() {
|
|
828
|
-
this.
|
|
842
|
+
this._authState = null;
|
|
843
|
+
}
|
|
844
|
+
}, {
|
|
845
|
+
key: "subscribe",
|
|
846
|
+
value: function subscribe(handler) {
|
|
847
|
+
this._emitter.on(EVENT_AUTH_STATE_CHANGE, handler);
|
|
848
|
+
}
|
|
849
|
+
}, {
|
|
850
|
+
key: "unsubscribe",
|
|
851
|
+
value: function unsubscribe(handler) {
|
|
852
|
+
this._emitter.off(EVENT_AUTH_STATE_CHANGE, handler);
|
|
829
853
|
}
|
|
830
854
|
}]);
|
|
831
855
|
}();
|
|
@@ -884,16 +908,27 @@ var TokenManager = /*#__PURE__*/function () {
|
|
|
884
908
|
key: "exchangeTokenFromCode",
|
|
885
909
|
value: function () {
|
|
886
910
|
var _exchangeTokenFromCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(accessCode, codeVerifier) {
|
|
887
|
-
var
|
|
911
|
+
var state,
|
|
912
|
+
body,
|
|
913
|
+
response,
|
|
914
|
+
_yield$response$json,
|
|
915
|
+
access_token,
|
|
916
|
+
id_token,
|
|
917
|
+
pubKey,
|
|
918
|
+
tokenVerified,
|
|
919
|
+
parsedAccessToken,
|
|
920
|
+
storageData,
|
|
921
|
+
_args = arguments;
|
|
888
922
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
889
923
|
while (1) switch (_context.prev = _context.next) {
|
|
890
924
|
case 0:
|
|
925
|
+
state = _args.length > 2 && _args[2] !== undefined ? _args[2] : null;
|
|
891
926
|
body = {
|
|
892
927
|
accessCode: accessCode,
|
|
893
928
|
codeVerifier: codeVerifier
|
|
894
929
|
};
|
|
895
|
-
_context.prev =
|
|
896
|
-
_context.next =
|
|
930
|
+
_context.prev = 2;
|
|
931
|
+
_context.next = 5;
|
|
897
932
|
return fetch(this.tokenEndPoint, {
|
|
898
933
|
method: 'POST',
|
|
899
934
|
headers: {
|
|
@@ -901,58 +936,66 @@ var TokenManager = /*#__PURE__*/function () {
|
|
|
901
936
|
},
|
|
902
937
|
body: JSON.stringify(body)
|
|
903
938
|
});
|
|
904
|
-
case
|
|
939
|
+
case 5:
|
|
905
940
|
response = _context.sent;
|
|
906
|
-
_context.next =
|
|
941
|
+
_context.next = 8;
|
|
907
942
|
return response.json();
|
|
908
|
-
case
|
|
943
|
+
case 8:
|
|
909
944
|
_yield$response$json = _context.sent;
|
|
910
945
|
access_token = _yield$response$json.access_token;
|
|
911
946
|
id_token = _yield$response$json.id_token;
|
|
912
947
|
if (!(!access_token || !id_token)) {
|
|
913
|
-
_context.next =
|
|
948
|
+
_context.next = 13;
|
|
914
949
|
break;
|
|
915
950
|
}
|
|
916
951
|
throw new _utils_errors__WEBPACK_IMPORTED_MODULE_2__["AuthError"]('Fail to exchange token');
|
|
917
|
-
case
|
|
918
|
-
_context.next =
|
|
952
|
+
case 13:
|
|
953
|
+
_context.next = 15;
|
|
919
954
|
return this.getPublicKey();
|
|
920
|
-
case
|
|
955
|
+
case 15:
|
|
921
956
|
pubKey = _context.sent;
|
|
922
|
-
_context.next =
|
|
957
|
+
_context.next = 18;
|
|
923
958
|
return Object(_crypto__WEBPACK_IMPORTED_MODULE_1__["verifyToken"])(id_token, pubKey);
|
|
924
|
-
case
|
|
959
|
+
case 18:
|
|
925
960
|
tokenVerified = _context.sent;
|
|
926
961
|
if (tokenVerified) {
|
|
927
|
-
_context.next =
|
|
962
|
+
_context.next = 21;
|
|
928
963
|
break;
|
|
929
964
|
}
|
|
930
965
|
throw new _utils_errors__WEBPACK_IMPORTED_MODULE_2__["AuthError"]('Unable to verify token');
|
|
931
|
-
case
|
|
966
|
+
case 21:
|
|
932
967
|
parsedAccessToken = Object(_utils__WEBPACK_IMPORTED_MODULE_0__["parseJwt"])(access_token);
|
|
933
|
-
|
|
968
|
+
storageData = Object.assign({
|
|
934
969
|
access_token: access_token,
|
|
935
970
|
id_token: id_token,
|
|
936
971
|
expired: parsedAccessToken.exp
|
|
972
|
+
}, state && {
|
|
973
|
+
state: state
|
|
937
974
|
});
|
|
938
|
-
|
|
975
|
+
this.storageManager.getStorageObject().setStorage(storageData);
|
|
976
|
+
_context.next = 30;
|
|
939
977
|
break;
|
|
940
|
-
case
|
|
941
|
-
_context.prev =
|
|
942
|
-
_context.t0 = _context["catch"](
|
|
978
|
+
case 26:
|
|
979
|
+
_context.prev = 26;
|
|
980
|
+
_context.t0 = _context["catch"](2);
|
|
943
981
|
console.log(_context.t0);
|
|
944
982
|
throw new _utils_errors__WEBPACK_IMPORTED_MODULE_2__["AuthError"]('Token acquisition failed');
|
|
945
|
-
case
|
|
983
|
+
case 30:
|
|
946
984
|
case "end":
|
|
947
985
|
return _context.stop();
|
|
948
986
|
}
|
|
949
|
-
}, _callee, this, [[
|
|
987
|
+
}, _callee, this, [[2, 26]]);
|
|
950
988
|
}));
|
|
951
989
|
function exchangeTokenFromCode(_x, _x2) {
|
|
952
990
|
return _exchangeTokenFromCode.apply(this, arguments);
|
|
953
991
|
}
|
|
954
992
|
return exchangeTokenFromCode;
|
|
955
993
|
}()
|
|
994
|
+
}, {
|
|
995
|
+
key: "getStateParameter",
|
|
996
|
+
value: function getStateParameter() {
|
|
997
|
+
return this.storageManager.getStorageObject().getItem('state');
|
|
998
|
+
}
|
|
956
999
|
}, {
|
|
957
1000
|
key: "getIdToken",
|
|
958
1001
|
value: function getIdToken() {
|