@aws-amplify/datastore 3.12.1 → 3.12.2-auth-hotfix.4
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.
|
@@ -60725,6 +60725,8 @@ function () {
|
|
|
60725
60725
|
this.userPool = null;
|
|
60726
60726
|
this.user = null;
|
|
60727
60727
|
this.oAuthFlowInProgress = false;
|
|
60728
|
+
this.inflightSessionPromise = null;
|
|
60729
|
+
this.inflightSession = false;
|
|
60728
60730
|
this.Credentials = _aws_amplify_core__WEBPACK_IMPORTED_MODULE_1__["Credentials"];
|
|
60729
60731
|
|
|
60730
60732
|
this.wrapRefreshSessionCallback = function (callback) {
|
|
@@ -62352,12 +62354,12 @@ function () {
|
|
|
62352
62354
|
return new Promise(function (res, rej) {
|
|
62353
62355
|
_this._storageSync.then(function () {
|
|
62354
62356
|
return __awaiter(_this, void 0, void 0, function () {
|
|
62355
|
-
var user, clientMetadata;
|
|
62357
|
+
var user, session, bypassCache, clientMetadata, _a, scope, err_1;
|
|
62356
62358
|
|
|
62357
62359
|
var _this = this;
|
|
62358
62360
|
|
|
62359
|
-
return __generator(this, function (
|
|
62360
|
-
switch (
|
|
62361
|
+
return __generator(this, function (_b) {
|
|
62362
|
+
switch (_b.label) {
|
|
62361
62363
|
case 0:
|
|
62362
62364
|
if (!this.isOAuthInProgress()) return [3
|
|
62363
62365
|
/*break*/
|
|
@@ -62387,9 +62389,9 @@ function () {
|
|
|
62387
62389
|
})];
|
|
62388
62390
|
|
|
62389
62391
|
case 1:
|
|
62390
|
-
|
|
62392
|
+
_b.sent();
|
|
62391
62393
|
|
|
62392
|
-
|
|
62394
|
+
_b.label = 2;
|
|
62393
62395
|
|
|
62394
62396
|
case 2:
|
|
62395
62397
|
user = this.userPool.getCurrentUser();
|
|
@@ -62402,167 +62404,135 @@ function () {
|
|
|
62402
62404
|
];
|
|
62403
62405
|
}
|
|
62404
62406
|
|
|
62405
|
-
|
|
62406
|
-
|
|
62407
|
-
user.getSession(function (err, session) {
|
|
62408
|
-
return __awaiter(_this, void 0, void 0, function () {
|
|
62409
|
-
var cleanUpError_5, bypassCache, clientMetadata, _a, scope;
|
|
62410
|
-
|
|
62411
|
-
var _this = this;
|
|
62412
|
-
|
|
62413
|
-
return __generator(this, function (_b) {
|
|
62414
|
-
switch (_b.label) {
|
|
62415
|
-
case 0:
|
|
62416
|
-
if (!err) return [3
|
|
62417
|
-
/*break*/
|
|
62418
|
-
, 5];
|
|
62419
|
-
logger.debug('Failed to get the user session', err);
|
|
62420
|
-
if (!this.isSessionInvalid(err)) return [3
|
|
62421
|
-
/*break*/
|
|
62422
|
-
, 4];
|
|
62423
|
-
_b.label = 1;
|
|
62424
|
-
|
|
62425
|
-
case 1:
|
|
62426
|
-
_b.trys.push([1, 3,, 4]);
|
|
62427
|
-
|
|
62428
|
-
return [4
|
|
62429
|
-
/*yield*/
|
|
62430
|
-
, this.cleanUpInvalidSession(user)];
|
|
62431
|
-
|
|
62432
|
-
case 2:
|
|
62433
|
-
_b.sent();
|
|
62434
|
-
|
|
62435
|
-
return [3
|
|
62436
|
-
/*break*/
|
|
62437
|
-
, 4];
|
|
62407
|
+
_b.label = 3;
|
|
62438
62408
|
|
|
62439
|
-
|
|
62440
|
-
|
|
62441
|
-
rej(new Error("Session is invalid due to: " + err.message + " and failed to clean up invalid session: " + cleanUpError_5.message));
|
|
62442
|
-
return [2
|
|
62443
|
-
/*return*/
|
|
62444
|
-
];
|
|
62409
|
+
case 3:
|
|
62410
|
+
_b.trys.push([3, 7,, 8]);
|
|
62445
62411
|
|
|
62446
|
-
|
|
62447
|
-
|
|
62448
|
-
|
|
62449
|
-
|
|
62450
|
-
|
|
62412
|
+
return [4
|
|
62413
|
+
/*yield*/
|
|
62414
|
+
, this._userSession({
|
|
62415
|
+
user: user
|
|
62416
|
+
})];
|
|
62451
62417
|
|
|
62452
|
-
|
|
62453
|
-
|
|
62454
|
-
|
|
62455
|
-
|
|
62456
|
-
|
|
62457
|
-
|
|
62458
|
-
|
|
62459
|
-
|
|
62418
|
+
case 4:
|
|
62419
|
+
session = _b.sent();
|
|
62420
|
+
bypassCache = params ? params.bypassCache : false;
|
|
62421
|
+
if (!bypassCache) return [3
|
|
62422
|
+
/*break*/
|
|
62423
|
+
, 6];
|
|
62424
|
+
return [4
|
|
62425
|
+
/*yield*/
|
|
62426
|
+
, this.Credentials.clear()];
|
|
62460
62427
|
|
|
62461
|
-
|
|
62462
|
-
|
|
62428
|
+
case 5:
|
|
62429
|
+
_b.sent();
|
|
62463
62430
|
|
|
62464
|
-
|
|
62431
|
+
_b.label = 6;
|
|
62465
62432
|
|
|
62466
|
-
|
|
62467
|
-
|
|
62468
|
-
|
|
62433
|
+
case 6:
|
|
62434
|
+
clientMetadata = this._config.clientMetadata;
|
|
62435
|
+
_a = session.getAccessToken().decodePayload().scope, scope = _a === void 0 ? '' : _a;
|
|
62469
62436
|
|
|
62470
|
-
|
|
62471
|
-
|
|
62472
|
-
|
|
62473
|
-
|
|
62474
|
-
|
|
62475
|
-
|
|
62476
|
-
|
|
62477
|
-
|
|
62478
|
-
|
|
62479
|
-
|
|
62480
|
-
|
|
62481
|
-
|
|
62482
|
-
|
|
62483
|
-
|
|
62484
|
-
|
|
62437
|
+
if (scope.split(' ').includes(USER_ADMIN_SCOPE)) {
|
|
62438
|
+
user.getUserData(function (err, data) {
|
|
62439
|
+
return __awaiter(_this, void 0, void 0, function () {
|
|
62440
|
+
var cleanUpError_5, preferredMFA, attributeList, i, attribute, userAttribute, attributes;
|
|
62441
|
+
return __generator(this, function (_a) {
|
|
62442
|
+
switch (_a.label) {
|
|
62443
|
+
case 0:
|
|
62444
|
+
if (!err) return [3
|
|
62445
|
+
/*break*/
|
|
62446
|
+
, 7];
|
|
62447
|
+
logger.debug('getting user data failed', err);
|
|
62448
|
+
if (!this.isSessionInvalid(err)) return [3
|
|
62449
|
+
/*break*/
|
|
62450
|
+
, 5];
|
|
62451
|
+
_a.label = 1;
|
|
62485
62452
|
|
|
62486
|
-
|
|
62487
|
-
|
|
62453
|
+
case 1:
|
|
62454
|
+
_a.trys.push([1, 3,, 4]);
|
|
62488
62455
|
|
|
62489
|
-
|
|
62490
|
-
|
|
62491
|
-
|
|
62456
|
+
return [4
|
|
62457
|
+
/*yield*/
|
|
62458
|
+
, this.cleanUpInvalidSession(user)];
|
|
62492
62459
|
|
|
62493
|
-
|
|
62494
|
-
|
|
62460
|
+
case 2:
|
|
62461
|
+
_a.sent();
|
|
62495
62462
|
|
|
62496
|
-
|
|
62497
|
-
|
|
62498
|
-
|
|
62463
|
+
return [3
|
|
62464
|
+
/*break*/
|
|
62465
|
+
, 4];
|
|
62499
62466
|
|
|
62500
|
-
|
|
62501
|
-
|
|
62502
|
-
|
|
62503
|
-
|
|
62504
|
-
|
|
62505
|
-
|
|
62467
|
+
case 3:
|
|
62468
|
+
cleanUpError_5 = _a.sent();
|
|
62469
|
+
rej(new Error("Session is invalid due to: " + err.message + " and failed to clean up invalid session: " + cleanUpError_5.message));
|
|
62470
|
+
return [2
|
|
62471
|
+
/*return*/
|
|
62472
|
+
];
|
|
62506
62473
|
|
|
62507
|
-
|
|
62508
|
-
|
|
62509
|
-
|
|
62510
|
-
|
|
62511
|
-
|
|
62474
|
+
case 4:
|
|
62475
|
+
rej(err);
|
|
62476
|
+
return [3
|
|
62477
|
+
/*break*/
|
|
62478
|
+
, 6];
|
|
62512
62479
|
|
|
62513
|
-
|
|
62514
|
-
|
|
62515
|
-
|
|
62480
|
+
case 5:
|
|
62481
|
+
res(user);
|
|
62482
|
+
_a.label = 6;
|
|
62516
62483
|
|
|
62517
|
-
|
|
62518
|
-
|
|
62519
|
-
|
|
62520
|
-
|
|
62484
|
+
case 6:
|
|
62485
|
+
return [2
|
|
62486
|
+
/*return*/
|
|
62487
|
+
];
|
|
62521
62488
|
|
|
62522
|
-
|
|
62523
|
-
|
|
62524
|
-
|
|
62525
|
-
|
|
62526
|
-
|
|
62527
|
-
|
|
62528
|
-
|
|
62529
|
-
|
|
62530
|
-
|
|
62531
|
-
|
|
62532
|
-
|
|
62533
|
-
|
|
62489
|
+
case 7:
|
|
62490
|
+
preferredMFA = data.PreferredMfaSetting || 'NOMFA';
|
|
62491
|
+
attributeList = [];
|
|
62492
|
+
|
|
62493
|
+
for (i = 0; i < data.UserAttributes.length; i++) {
|
|
62494
|
+
attribute = {
|
|
62495
|
+
Name: data.UserAttributes[i].Name,
|
|
62496
|
+
Value: data.UserAttributes[i].Value
|
|
62497
|
+
};
|
|
62498
|
+
userAttribute = new amazon_cognito_identity_js__WEBPACK_IMPORTED_MODULE_2__["CognitoUserAttribute"](attribute);
|
|
62499
|
+
attributeList.push(userAttribute);
|
|
62500
|
+
}
|
|
62534
62501
|
|
|
62535
|
-
|
|
62536
|
-
|
|
62537
|
-
|
|
62538
|
-
|
|
62539
|
-
});
|
|
62540
|
-
return [2
|
|
62541
|
-
/*return*/
|
|
62542
|
-
, res(user)];
|
|
62543
|
-
}
|
|
62544
|
-
});
|
|
62545
|
-
});
|
|
62546
|
-
}, {
|
|
62547
|
-
bypassCache: bypassCache,
|
|
62548
|
-
clientMetadata: clientMetadata
|
|
62502
|
+
attributes = this.attributesToObject(attributeList);
|
|
62503
|
+
Object.assign(user, {
|
|
62504
|
+
attributes: attributes,
|
|
62505
|
+
preferredMFA: preferredMFA
|
|
62549
62506
|
});
|
|
62550
|
-
} else {
|
|
62551
|
-
logger.debug("Unable to get the user data because the " + USER_ADMIN_SCOPE + " " + "is not in the scopes of the access token");
|
|
62552
62507
|
return [2
|
|
62553
62508
|
/*return*/
|
|
62554
62509
|
, res(user)];
|
|
62555
|
-
|
|
62556
|
-
|
|
62557
|
-
return [2
|
|
62558
|
-
/*return*/
|
|
62559
|
-
];
|
|
62560
|
-
}
|
|
62510
|
+
}
|
|
62511
|
+
});
|
|
62561
62512
|
});
|
|
62513
|
+
}, {
|
|
62514
|
+
bypassCache: bypassCache,
|
|
62515
|
+
clientMetadata: clientMetadata
|
|
62562
62516
|
});
|
|
62563
|
-
}
|
|
62564
|
-
|
|
62565
|
-
|
|
62517
|
+
} else {
|
|
62518
|
+
logger.debug("Unable to get the user data because the " + USER_ADMIN_SCOPE + " " + "is not in the scopes of the access token");
|
|
62519
|
+
return [2
|
|
62520
|
+
/*return*/
|
|
62521
|
+
, res(user)];
|
|
62522
|
+
}
|
|
62523
|
+
|
|
62524
|
+
return [3
|
|
62525
|
+
/*break*/
|
|
62526
|
+
, 8];
|
|
62527
|
+
|
|
62528
|
+
case 7:
|
|
62529
|
+
err_1 = _b.sent();
|
|
62530
|
+
rej(err_1);
|
|
62531
|
+
return [3
|
|
62532
|
+
/*break*/
|
|
62533
|
+
, 8];
|
|
62534
|
+
|
|
62535
|
+
case 8:
|
|
62566
62536
|
return [2
|
|
62567
62537
|
/*return*/
|
|
62568
62538
|
];
|
|
@@ -62707,16 +62677,14 @@ function () {
|
|
|
62707
62677
|
});
|
|
62708
62678
|
});
|
|
62709
62679
|
};
|
|
62710
|
-
/**
|
|
62711
|
-
* Get the corresponding user session
|
|
62712
|
-
* @param {Object} user - The CognitoUser object
|
|
62713
|
-
* @return - A promise resolves to the session
|
|
62714
|
-
*/
|
|
62715
62680
|
|
|
62716
|
-
|
|
62717
|
-
AuthClass.prototype.userSession = function (user) {
|
|
62681
|
+
AuthClass.prototype._userSession = function (_a) {
|
|
62718
62682
|
var _this = this;
|
|
62719
62683
|
|
|
62684
|
+
var user = _a.user,
|
|
62685
|
+
_b = _a.bypassCache,
|
|
62686
|
+
bypassCache = _b === void 0 ? false : _b;
|
|
62687
|
+
|
|
62720
62688
|
if (!user) {
|
|
62721
62689
|
logger.debug('the user is null');
|
|
62722
62690
|
return this.rejectAuthError(_types_Auth__WEBPACK_IMPORTED_MODULE_7__["AuthErrorTypes"].NoUserSession);
|
|
@@ -62724,64 +62692,138 @@ function () {
|
|
|
62724
62692
|
|
|
62725
62693
|
var clientMetadata = this._config.clientMetadata; // TODO: verify behavior if this is override during signIn
|
|
62726
62694
|
|
|
62727
|
-
return new Promise(function (
|
|
62728
|
-
|
|
62729
|
-
|
|
62730
|
-
return __awaiter(_this, void 0, void 0, function () {
|
|
62731
|
-
var cleanUpError_7;
|
|
62732
|
-
return __generator(this, function (_a) {
|
|
62733
|
-
switch (_a.label) {
|
|
62734
|
-
case 0:
|
|
62735
|
-
if (!err) return [3
|
|
62736
|
-
/*break*/
|
|
62737
|
-
, 5];
|
|
62738
|
-
logger.debug('Failed to get the session from user', user);
|
|
62739
|
-
if (!this.isSessionInvalid(err)) return [3
|
|
62740
|
-
/*break*/
|
|
62741
|
-
, 4];
|
|
62742
|
-
_a.label = 1;
|
|
62695
|
+
return new Promise(function (resolve, rej) {
|
|
62696
|
+
return __awaiter(_this, void 0, void 0, function () {
|
|
62697
|
+
var debounceResolver;
|
|
62743
62698
|
|
|
62744
|
-
|
|
62745
|
-
_a.trys.push([1, 3,, 4]);
|
|
62699
|
+
var _this = this;
|
|
62746
62700
|
|
|
62747
|
-
|
|
62748
|
-
|
|
62749
|
-
|
|
62701
|
+
return __generator(this, function (_a) {
|
|
62702
|
+
switch (_a.label) {
|
|
62703
|
+
case 0:
|
|
62704
|
+
// debugger;
|
|
62705
|
+
logger.debug('Getting the session from this user:', user);
|
|
62706
|
+
if (!this.inflightSession) return [3
|
|
62707
|
+
/*break*/
|
|
62708
|
+
, 2];
|
|
62709
|
+
logger.debug('Waiting for another userSession call:');
|
|
62710
|
+
return [4
|
|
62711
|
+
/*yield*/
|
|
62712
|
+
, this.inflightSessionPromise];
|
|
62750
62713
|
|
|
62751
|
-
|
|
62752
|
-
|
|
62714
|
+
case 1:
|
|
62715
|
+
_a.sent();
|
|
62753
62716
|
|
|
62754
|
-
|
|
62755
|
-
|
|
62756
|
-
|
|
62717
|
+
logger.debug('Debouncer resolved');
|
|
62718
|
+
return [3
|
|
62719
|
+
/*break*/
|
|
62720
|
+
, 3];
|
|
62757
62721
|
|
|
62758
|
-
|
|
62759
|
-
|
|
62760
|
-
|
|
62761
|
-
|
|
62762
|
-
|
|
62763
|
-
|
|
62722
|
+
case 2:
|
|
62723
|
+
logger.debug('Debouncer head');
|
|
62724
|
+
this.inflightSession = true;
|
|
62725
|
+
this.inflightSessionPromise = new Promise(function (res) {
|
|
62726
|
+
debounceResolver = function debounceResolver() {
|
|
62727
|
+
logger.debug('Debouncer resolving');
|
|
62728
|
+
_this.inflightSessionPromise = null;
|
|
62729
|
+
_this.inflightSession = false;
|
|
62730
|
+
res();
|
|
62731
|
+
};
|
|
62732
|
+
});
|
|
62733
|
+
_a.label = 3;
|
|
62764
62734
|
|
|
62765
|
-
|
|
62766
|
-
|
|
62767
|
-
return
|
|
62768
|
-
|
|
62769
|
-
|
|
62735
|
+
case 3:
|
|
62736
|
+
user.getSession(function (err, session) {
|
|
62737
|
+
return __awaiter(_this, void 0, void 0, function () {
|
|
62738
|
+
var cleanUpError_6;
|
|
62739
|
+
return __generator(this, function (_a) {
|
|
62740
|
+
switch (_a.label) {
|
|
62741
|
+
case 0:
|
|
62742
|
+
if (!err) return [3
|
|
62743
|
+
/*break*/
|
|
62744
|
+
, 5];
|
|
62745
|
+
logger.debug('Failed to get the session from user', user);
|
|
62746
|
+
if (!this.isSessionInvalid(err)) return [3
|
|
62747
|
+
/*break*/
|
|
62748
|
+
, 4];
|
|
62749
|
+
_a.label = 1;
|
|
62770
62750
|
|
|
62771
|
-
|
|
62772
|
-
|
|
62773
|
-
|
|
62774
|
-
|
|
62775
|
-
|
|
62776
|
-
|
|
62777
|
-
|
|
62778
|
-
|
|
62751
|
+
case 1:
|
|
62752
|
+
_a.trys.push([1, 3,, 4]);
|
|
62753
|
+
|
|
62754
|
+
return [4
|
|
62755
|
+
/*yield*/
|
|
62756
|
+
, this.cleanUpInvalidSession(user)];
|
|
62757
|
+
|
|
62758
|
+
case 2:
|
|
62759
|
+
_a.sent();
|
|
62760
|
+
|
|
62761
|
+
return [3
|
|
62762
|
+
/*break*/
|
|
62763
|
+
, 4];
|
|
62764
|
+
|
|
62765
|
+
case 3:
|
|
62766
|
+
cleanUpError_6 = _a.sent();
|
|
62767
|
+
rej(new Error("Session is invalid due to: " + err.message + " and failed to clean up invalid session: " + cleanUpError_6.message));
|
|
62768
|
+
|
|
62769
|
+
if (debounceResolver) {
|
|
62770
|
+
debounceResolver();
|
|
62771
|
+
}
|
|
62772
|
+
|
|
62773
|
+
return [2
|
|
62774
|
+
/*return*/
|
|
62775
|
+
];
|
|
62776
|
+
|
|
62777
|
+
case 4:
|
|
62778
|
+
rej(err);
|
|
62779
|
+
|
|
62780
|
+
if (debounceResolver) {
|
|
62781
|
+
debounceResolver();
|
|
62782
|
+
}
|
|
62783
|
+
|
|
62784
|
+
return [2
|
|
62785
|
+
/*return*/
|
|
62786
|
+
];
|
|
62787
|
+
|
|
62788
|
+
case 5:
|
|
62789
|
+
logger.debug('Succeed to get the user session', session);
|
|
62790
|
+
resolve(session);
|
|
62791
|
+
|
|
62792
|
+
if (debounceResolver) {
|
|
62793
|
+
debounceResolver();
|
|
62794
|
+
}
|
|
62795
|
+
|
|
62796
|
+
return [2
|
|
62797
|
+
/*return*/
|
|
62798
|
+
];
|
|
62799
|
+
}
|
|
62800
|
+
});
|
|
62801
|
+
});
|
|
62802
|
+
}, {
|
|
62803
|
+
clientMetadata: clientMetadata,
|
|
62804
|
+
bypassCache: bypassCache
|
|
62805
|
+
});
|
|
62806
|
+
return [2
|
|
62807
|
+
/*return*/
|
|
62808
|
+
];
|
|
62809
|
+
}
|
|
62779
62810
|
});
|
|
62780
|
-
}, {
|
|
62781
|
-
clientMetadata: clientMetadata
|
|
62782
62811
|
});
|
|
62783
62812
|
});
|
|
62784
62813
|
};
|
|
62814
|
+
/**
|
|
62815
|
+
* Get the corresponding user session
|
|
62816
|
+
* @param {Object} user - The CognitoUser object
|
|
62817
|
+
* @return - A promise resolves to the session
|
|
62818
|
+
*/
|
|
62819
|
+
|
|
62820
|
+
|
|
62821
|
+
AuthClass.prototype.userSession = function (user) {
|
|
62822
|
+
return this._userSession({
|
|
62823
|
+
user: user,
|
|
62824
|
+
bypassCache: false
|
|
62825
|
+
});
|
|
62826
|
+
};
|
|
62785
62827
|
/**
|
|
62786
62828
|
* Get authenticated credentials of current user.
|
|
62787
62829
|
* @return - A promise resolves to be current user's credentials
|
|
@@ -62970,7 +63012,7 @@ function () {
|
|
|
62970
63012
|
|
|
62971
63013
|
user.getSession(function (err, result) {
|
|
62972
63014
|
return __awaiter(_this, void 0, void 0, function () {
|
|
62973
|
-
var
|
|
63015
|
+
var cleanUpError_7;
|
|
62974
63016
|
|
|
62975
63017
|
var _this = this;
|
|
62976
63018
|
|
|
@@ -63001,8 +63043,8 @@ function () {
|
|
|
63001
63043
|
, 4];
|
|
63002
63044
|
|
|
63003
63045
|
case 3:
|
|
63004
|
-
|
|
63005
|
-
rej(new Error("Session is invalid due to: " + err.message + " and failed to clean up invalid session: " +
|
|
63046
|
+
cleanUpError_7 = _a.sent();
|
|
63047
|
+
rej(new Error("Session is invalid due to: " + err.message + " and failed to clean up invalid session: " + cleanUpError_7.message));
|
|
63006
63048
|
return [2
|
|
63007
63049
|
/*return*/
|
|
63008
63050
|
];
|
|
@@ -63306,7 +63348,7 @@ function () {
|
|
|
63306
63348
|
|
|
63307
63349
|
AuthClass.prototype.currentUserInfo = function () {
|
|
63308
63350
|
return __awaiter(this, void 0, void 0, function () {
|
|
63309
|
-
var source, user, attributes, userAttrs, credentials, e_12, info,
|
|
63351
|
+
var source, user, attributes, userAttrs, credentials, e_12, info, err_2, user;
|
|
63310
63352
|
return __generator(this, function (_a) {
|
|
63311
63353
|
switch (_a.label) {
|
|
63312
63354
|
case 0:
|
|
@@ -63375,8 +63417,8 @@ function () {
|
|
|
63375
63417
|
, info];
|
|
63376
63418
|
|
|
63377
63419
|
case 8:
|
|
63378
|
-
|
|
63379
|
-
logger.error('currentUserInfo error',
|
|
63420
|
+
err_2 = _a.sent();
|
|
63421
|
+
logger.error('currentUserInfo error', err_2);
|
|
63380
63422
|
return [2
|
|
63381
63423
|
/*return*/
|
|
63382
63424
|
, {}];
|
|
@@ -63486,7 +63528,7 @@ function () {
|
|
|
63486
63528
|
|
|
63487
63529
|
AuthClass.prototype._handleAuthResponse = function (URL) {
|
|
63488
63530
|
return __awaiter(this, void 0, void 0, function () {
|
|
63489
|
-
var currentUrl, hasCodeOrError, hasTokenOrError, _a, accessToken, idToken, refreshToken, state, session, credentials, isCustomStateIncluded, currentUser, customState,
|
|
63531
|
+
var currentUrl, hasCodeOrError, hasTokenOrError, _a, accessToken, idToken, refreshToken, state, session, credentials, isCustomStateIncluded, currentUser, customState, err_3;
|
|
63490
63532
|
|
|
63491
63533
|
return __generator(this, function (_b) {
|
|
63492
63534
|
switch (_b.label) {
|
|
@@ -63594,17 +63636,17 @@ function () {
|
|
|
63594
63636
|
, credentials];
|
|
63595
63637
|
|
|
63596
63638
|
case 6:
|
|
63597
|
-
|
|
63598
|
-
logger.debug('Error in cognito hosted auth response',
|
|
63639
|
+
err_3 = _b.sent();
|
|
63640
|
+
logger.debug('Error in cognito hosted auth response', err_3); // Just like a successful handling of `?code`, replace the window history to "dispose" of the `code`.
|
|
63599
63641
|
// Otherwise, reloading the page will throw errors as the `code` has already been spent.
|
|
63600
63642
|
|
|
63601
63643
|
if (window && typeof window.history !== 'undefined') {
|
|
63602
63644
|
window.history.replaceState({}, null, this._config.oauth.redirectSignIn);
|
|
63603
63645
|
}
|
|
63604
63646
|
|
|
63605
|
-
dispatchAuthEvent('signIn_failure',
|
|
63606
|
-
dispatchAuthEvent('cognitoHostedUI_failure',
|
|
63607
|
-
dispatchAuthEvent('customState_failure',
|
|
63647
|
+
dispatchAuthEvent('signIn_failure', err_3, "The OAuth response flow failed");
|
|
63648
|
+
dispatchAuthEvent('cognitoHostedUI_failure', err_3, "A failure occurred when returning to the Cognito Hosted UI");
|
|
63649
|
+
dispatchAuthEvent('customState_failure', err_3, "A failure occurred when returning state");
|
|
63608
63650
|
return [3
|
|
63609
63651
|
/*break*/
|
|
63610
63652
|
, 7];
|
|
@@ -71245,7 +71287,7 @@ var getAmplifyUserAgent = function getAmplifyUserAgent() {
|
|
|
71245
71287
|
__webpack_require__.r(__webpack_exports__);
|
|
71246
71288
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "version", function() { return version; });
|
|
71247
71289
|
// generated by genversion
|
|
71248
|
-
var version = '4.5.
|
|
71290
|
+
var version = '4.5.8';
|
|
71249
71291
|
|
|
71250
71292
|
/***/ }),
|
|
71251
71293
|
|