@aws-amplify/auth 4.5.8-unstable.7 → 4.5.9-auth-hotfix.5
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/CHANGELOG.md +20 -0
- package/dist/aws-amplify-auth.js +242 -231
- package/dist/aws-amplify-auth.js.map +1 -1
- package/dist/aws-amplify-auth.min.js +7 -7
- package/dist/aws-amplify-auth.min.js.map +1 -1
- package/lib/Auth.d.ts +2 -0
- package/lib/Auth.js +151 -145
- package/lib/Auth.js.map +1 -1
- package/lib/urlListener.js +2 -2
- package/lib/urlListener.js.map +1 -1
- package/lib-esm/Auth.d.ts +2 -0
- package/lib-esm/Auth.js +152 -146
- package/lib-esm/Auth.js.map +1 -1
- package/lib-esm/urlListener.js +3 -3
- package/lib-esm/urlListener.js.map +1 -1
- package/package.json +5 -5
- package/src/Auth.ts +116 -114
- package/src/urlListener.ts +3 -3
package/lib/Auth.d.ts
CHANGED
|
@@ -15,6 +15,7 @@ export declare class AuthClass {
|
|
|
15
15
|
private _storageSync;
|
|
16
16
|
private oAuthFlowInProgress;
|
|
17
17
|
private pendingSignIn;
|
|
18
|
+
private inflightSessionPromise;
|
|
18
19
|
Credentials: import("@aws-amplify/core").CredentialsClass;
|
|
19
20
|
/**
|
|
20
21
|
* Initialize Auth with AWS configurations
|
|
@@ -192,6 +193,7 @@ export declare class AuthClass {
|
|
|
192
193
|
* @return - A promise resolves to session object if success
|
|
193
194
|
*/
|
|
194
195
|
currentSession(): Promise<CognitoUserSession>;
|
|
196
|
+
private _userSession;
|
|
195
197
|
/**
|
|
196
198
|
* Get the corresponding user session
|
|
197
199
|
* @param {Object} user - The CognitoUser object
|
package/lib/Auth.js
CHANGED
|
@@ -113,6 +113,7 @@ var AuthClass = /** @class */ (function () {
|
|
|
113
113
|
this.userPool = null;
|
|
114
114
|
this.user = null;
|
|
115
115
|
this.oAuthFlowInProgress = false;
|
|
116
|
+
this.inflightSessionPromise = null;
|
|
116
117
|
this.Credentials = core_1.Credentials;
|
|
117
118
|
this.wrapRefreshSessionCallback = function (callback) {
|
|
118
119
|
var wrapped = function (error, data) {
|
|
@@ -1335,10 +1336,10 @@ var AuthClass = /** @class */ (function () {
|
|
|
1335
1336
|
return new Promise(function (res, rej) {
|
|
1336
1337
|
_this._storageSync
|
|
1337
1338
|
.then(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
1338
|
-
var user, clientMetadata;
|
|
1339
|
+
var user, session, bypassCache, clientMetadata, _a, scope, err_1;
|
|
1339
1340
|
var _this = this;
|
|
1340
|
-
return __generator(this, function (
|
|
1341
|
-
switch (
|
|
1341
|
+
return __generator(this, function (_b) {
|
|
1342
|
+
switch (_b.label) {
|
|
1342
1343
|
case 0:
|
|
1343
1344
|
if (!this.isOAuthInProgress()) return [3 /*break*/, 2];
|
|
1344
1345
|
logger.debug('OAuth signIn in progress, waiting for resolution...');
|
|
@@ -1362,8 +1363,8 @@ var AuthClass = /** @class */ (function () {
|
|
|
1362
1363
|
}
|
|
1363
1364
|
})];
|
|
1364
1365
|
case 1:
|
|
1365
|
-
|
|
1366
|
-
|
|
1366
|
+
_b.sent();
|
|
1367
|
+
_b.label = 2;
|
|
1367
1368
|
case 2:
|
|
1368
1369
|
user = this.userPool.getCurrentUser();
|
|
1369
1370
|
if (!user) {
|
|
@@ -1371,96 +1372,77 @@ var AuthClass = /** @class */ (function () {
|
|
|
1371
1372
|
rej('No current user');
|
|
1372
1373
|
return [2 /*return*/];
|
|
1373
1374
|
}
|
|
1375
|
+
_b.label = 3;
|
|
1376
|
+
case 3:
|
|
1377
|
+
_b.trys.push([3, 7, , 8]);
|
|
1378
|
+
return [4 /*yield*/, this._userSession({ user: user })];
|
|
1379
|
+
case 4:
|
|
1380
|
+
session = _b.sent();
|
|
1381
|
+
bypassCache = params ? params.bypassCache : false;
|
|
1382
|
+
if (!bypassCache) return [3 /*break*/, 6];
|
|
1383
|
+
return [4 /*yield*/, this.Credentials.clear()];
|
|
1384
|
+
case 5:
|
|
1385
|
+
_b.sent();
|
|
1386
|
+
_b.label = 6;
|
|
1387
|
+
case 6:
|
|
1374
1388
|
clientMetadata = this._config.clientMetadata;
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
return [
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
logger.debug('getting user data failed', err);
|
|
1417
|
-
if (!this.isSessionInvalid(err)) return [3 /*break*/, 5];
|
|
1418
|
-
_a.label = 1;
|
|
1419
|
-
case 1:
|
|
1420
|
-
_a.trys.push([1, 3, , 4]);
|
|
1421
|
-
return [4 /*yield*/, this.cleanUpInvalidSession(user)];
|
|
1422
|
-
case 2:
|
|
1423
|
-
_a.sent();
|
|
1424
|
-
return [3 /*break*/, 4];
|
|
1425
|
-
case 3:
|
|
1426
|
-
cleanUpError_6 = _a.sent();
|
|
1427
|
-
rej(new Error("Session is invalid due to: " + err.message + " and failed to clean up invalid session: " + cleanUpError_6.message));
|
|
1428
|
-
return [2 /*return*/];
|
|
1429
|
-
case 4:
|
|
1430
|
-
rej(err);
|
|
1431
|
-
return [3 /*break*/, 6];
|
|
1432
|
-
case 5:
|
|
1433
|
-
res(user);
|
|
1434
|
-
_a.label = 6;
|
|
1435
|
-
case 6: return [2 /*return*/];
|
|
1436
|
-
case 7:
|
|
1437
|
-
preferredMFA = data.PreferredMfaSetting || 'NOMFA';
|
|
1438
|
-
attributeList = [];
|
|
1439
|
-
for (i = 0; i < data.UserAttributes.length; i++) {
|
|
1440
|
-
attribute = {
|
|
1441
|
-
Name: data.UserAttributes[i].Name,
|
|
1442
|
-
Value: data.UserAttributes[i].Value,
|
|
1443
|
-
};
|
|
1444
|
-
userAttribute = new amazon_cognito_identity_js_1.CognitoUserAttribute(attribute);
|
|
1445
|
-
attributeList.push(userAttribute);
|
|
1446
|
-
}
|
|
1447
|
-
attributes = this.attributesToObject(attributeList);
|
|
1448
|
-
Object.assign(user, { attributes: attributes, preferredMFA: preferredMFA });
|
|
1449
|
-
return [2 /*return*/, res(user)];
|
|
1450
|
-
}
|
|
1451
|
-
});
|
|
1452
|
-
}); }, { bypassCache: bypassCache, clientMetadata: clientMetadata });
|
|
1453
|
-
}
|
|
1454
|
-
else {
|
|
1455
|
-
logger.debug("Unable to get the user data because the " + USER_ADMIN_SCOPE + " " +
|
|
1456
|
-
"is not in the scopes of the access token");
|
|
1389
|
+
_a = session.getAccessToken().decodePayload().scope, scope = _a === void 0 ? '' : _a;
|
|
1390
|
+
if (scope.split(' ').includes(USER_ADMIN_SCOPE)) {
|
|
1391
|
+
user.getUserData(function (err, data) { return __awaiter(_this, void 0, void 0, function () {
|
|
1392
|
+
var cleanUpError_5, preferredMFA, attributeList, i, attribute, userAttribute, attributes;
|
|
1393
|
+
return __generator(this, function (_a) {
|
|
1394
|
+
switch (_a.label) {
|
|
1395
|
+
case 0:
|
|
1396
|
+
if (!err) return [3 /*break*/, 7];
|
|
1397
|
+
logger.debug('getting user data failed', err);
|
|
1398
|
+
if (!this.isSessionInvalid(err)) return [3 /*break*/, 5];
|
|
1399
|
+
_a.label = 1;
|
|
1400
|
+
case 1:
|
|
1401
|
+
_a.trys.push([1, 3, , 4]);
|
|
1402
|
+
return [4 /*yield*/, this.cleanUpInvalidSession(user)];
|
|
1403
|
+
case 2:
|
|
1404
|
+
_a.sent();
|
|
1405
|
+
return [3 /*break*/, 4];
|
|
1406
|
+
case 3:
|
|
1407
|
+
cleanUpError_5 = _a.sent();
|
|
1408
|
+
rej(new Error("Session is invalid due to: " + err.message + " and failed to clean up invalid session: " + cleanUpError_5.message));
|
|
1409
|
+
return [2 /*return*/];
|
|
1410
|
+
case 4:
|
|
1411
|
+
rej(err);
|
|
1412
|
+
return [3 /*break*/, 6];
|
|
1413
|
+
case 5:
|
|
1414
|
+
res(user);
|
|
1415
|
+
_a.label = 6;
|
|
1416
|
+
case 6: return [2 /*return*/];
|
|
1417
|
+
case 7:
|
|
1418
|
+
preferredMFA = data.PreferredMfaSetting || 'NOMFA';
|
|
1419
|
+
attributeList = [];
|
|
1420
|
+
for (i = 0; i < data.UserAttributes.length; i++) {
|
|
1421
|
+
attribute = {
|
|
1422
|
+
Name: data.UserAttributes[i].Name,
|
|
1423
|
+
Value: data.UserAttributes[i].Value,
|
|
1424
|
+
};
|
|
1425
|
+
userAttribute = new amazon_cognito_identity_js_1.CognitoUserAttribute(attribute);
|
|
1426
|
+
attributeList.push(userAttribute);
|
|
1427
|
+
}
|
|
1428
|
+
attributes = this.attributesToObject(attributeList);
|
|
1429
|
+
Object.assign(user, { attributes: attributes, preferredMFA: preferredMFA });
|
|
1457
1430
|
return [2 /*return*/, res(user)];
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1431
|
+
}
|
|
1432
|
+
});
|
|
1433
|
+
}); }, { bypassCache: bypassCache, clientMetadata: clientMetadata });
|
|
1434
|
+
}
|
|
1435
|
+
else {
|
|
1436
|
+
logger.debug("Unable to get the user data because the " + USER_ADMIN_SCOPE + " " +
|
|
1437
|
+
"is not in the scopes of the access token");
|
|
1438
|
+
return [2 /*return*/, res(user)];
|
|
1439
|
+
}
|
|
1440
|
+
return [3 /*break*/, 8];
|
|
1441
|
+
case 7:
|
|
1442
|
+
err_1 = _b.sent();
|
|
1443
|
+
rej(err_1);
|
|
1444
|
+
return [3 /*break*/, 8];
|
|
1445
|
+
case 8: return [2 /*return*/];
|
|
1464
1446
|
}
|
|
1465
1447
|
});
|
|
1466
1448
|
}); })
|
|
@@ -1570,50 +1552,74 @@ var AuthClass = /** @class */ (function () {
|
|
|
1570
1552
|
});
|
|
1571
1553
|
});
|
|
1572
1554
|
};
|
|
1555
|
+
AuthClass.prototype._userSession = function (_a) {
|
|
1556
|
+
var user = _a.user, _b = _a.bypassCache, bypassCache = _b === void 0 ? false : _b;
|
|
1557
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
1558
|
+
var clientMetadata;
|
|
1559
|
+
var _this = this;
|
|
1560
|
+
return __generator(this, function (_c) {
|
|
1561
|
+
switch (_c.label) {
|
|
1562
|
+
case 0:
|
|
1563
|
+
if (!user) {
|
|
1564
|
+
logger.debug('the user is null');
|
|
1565
|
+
return [2 /*return*/, this.rejectAuthError(Auth_1.AuthErrorTypes.NoUserSession)];
|
|
1566
|
+
}
|
|
1567
|
+
clientMetadata = this._config.clientMetadata;
|
|
1568
|
+
if (!this.inflightSessionPromise) return [3 /*break*/, 2];
|
|
1569
|
+
return [4 /*yield*/, this.inflightSessionPromise];
|
|
1570
|
+
case 1: return [2 /*return*/, _c.sent()];
|
|
1571
|
+
case 2:
|
|
1572
|
+
this.inflightSessionPromise = new Promise(function (resolve, rej) {
|
|
1573
|
+
user.getSession(function (err, session) { return __awaiter(_this, void 0, void 0, function () {
|
|
1574
|
+
var cleanUpError_6;
|
|
1575
|
+
return __generator(this, function (_a) {
|
|
1576
|
+
switch (_a.label) {
|
|
1577
|
+
case 0:
|
|
1578
|
+
if (!err) return [3 /*break*/, 5];
|
|
1579
|
+
logger.debug('Failed to get the session from user', user);
|
|
1580
|
+
if (!this.isSessionInvalid(err)) return [3 /*break*/, 4];
|
|
1581
|
+
_a.label = 1;
|
|
1582
|
+
case 1:
|
|
1583
|
+
_a.trys.push([1, 3, , 4]);
|
|
1584
|
+
return [4 /*yield*/, this.cleanUpInvalidSession(user)];
|
|
1585
|
+
case 2:
|
|
1586
|
+
_a.sent();
|
|
1587
|
+
return [3 /*break*/, 4];
|
|
1588
|
+
case 3:
|
|
1589
|
+
cleanUpError_6 = _a.sent();
|
|
1590
|
+
rej(new Error("Session is invalid due to: " + err.message + " and failed to clean up invalid session: " + cleanUpError_6.message));
|
|
1591
|
+
return [2 /*return*/];
|
|
1592
|
+
case 4:
|
|
1593
|
+
rej(err);
|
|
1594
|
+
return [2 /*return*/];
|
|
1595
|
+
case 5:
|
|
1596
|
+
logger.debug('Succeed to get the user session', session);
|
|
1597
|
+
resolve(session);
|
|
1598
|
+
return [2 /*return*/];
|
|
1599
|
+
}
|
|
1600
|
+
});
|
|
1601
|
+
}); }, { clientMetadata: clientMetadata, bypassCache: bypassCache });
|
|
1602
|
+
})
|
|
1603
|
+
.then(function (session) {
|
|
1604
|
+
_this.inflightSessionPromise = null;
|
|
1605
|
+
return session;
|
|
1606
|
+
})
|
|
1607
|
+
.catch(function (err) {
|
|
1608
|
+
_this.inflightSessionPromise = null;
|
|
1609
|
+
throw err;
|
|
1610
|
+
});
|
|
1611
|
+
return [2 /*return*/, this.inflightSessionPromise];
|
|
1612
|
+
}
|
|
1613
|
+
});
|
|
1614
|
+
});
|
|
1615
|
+
};
|
|
1573
1616
|
/**
|
|
1574
1617
|
* Get the corresponding user session
|
|
1575
1618
|
* @param {Object} user - The CognitoUser object
|
|
1576
1619
|
* @return - A promise resolves to the session
|
|
1577
1620
|
*/
|
|
1578
1621
|
AuthClass.prototype.userSession = function (user) {
|
|
1579
|
-
|
|
1580
|
-
if (!user) {
|
|
1581
|
-
logger.debug('the user is null');
|
|
1582
|
-
return this.rejectAuthError(Auth_1.AuthErrorTypes.NoUserSession);
|
|
1583
|
-
}
|
|
1584
|
-
var clientMetadata = this._config.clientMetadata; // TODO: verify behavior if this is override during signIn
|
|
1585
|
-
return new Promise(function (res, rej) {
|
|
1586
|
-
logger.debug('Getting the session from this user:', user);
|
|
1587
|
-
user.getSession(function (err, session) { return __awaiter(_this, void 0, void 0, function () {
|
|
1588
|
-
var cleanUpError_7;
|
|
1589
|
-
return __generator(this, function (_a) {
|
|
1590
|
-
switch (_a.label) {
|
|
1591
|
-
case 0:
|
|
1592
|
-
if (!err) return [3 /*break*/, 5];
|
|
1593
|
-
logger.debug('Failed to get the session from user', user);
|
|
1594
|
-
if (!this.isSessionInvalid(err)) return [3 /*break*/, 4];
|
|
1595
|
-
_a.label = 1;
|
|
1596
|
-
case 1:
|
|
1597
|
-
_a.trys.push([1, 3, , 4]);
|
|
1598
|
-
return [4 /*yield*/, this.cleanUpInvalidSession(user)];
|
|
1599
|
-
case 2:
|
|
1600
|
-
_a.sent();
|
|
1601
|
-
return [3 /*break*/, 4];
|
|
1602
|
-
case 3:
|
|
1603
|
-
cleanUpError_7 = _a.sent();
|
|
1604
|
-
rej(new Error("Session is invalid due to: " + err.message + " and failed to clean up invalid session: " + cleanUpError_7.message));
|
|
1605
|
-
return [2 /*return*/];
|
|
1606
|
-
case 4:
|
|
1607
|
-
rej(err);
|
|
1608
|
-
return [2 /*return*/];
|
|
1609
|
-
case 5:
|
|
1610
|
-
logger.debug('Succeed to get the user session', session);
|
|
1611
|
-
res(session);
|
|
1612
|
-
return [2 /*return*/];
|
|
1613
|
-
}
|
|
1614
|
-
});
|
|
1615
|
-
}); }, { clientMetadata: clientMetadata });
|
|
1616
|
-
});
|
|
1622
|
+
return this._userSession({ user: user, bypassCache: false });
|
|
1617
1623
|
};
|
|
1618
1624
|
/**
|
|
1619
1625
|
* Get authenticated credentials of current user.
|
|
@@ -1757,7 +1763,7 @@ var AuthClass = /** @class */ (function () {
|
|
|
1757
1763
|
// we must validate the user as an authenticated user by using getSession
|
|
1758
1764
|
var clientMetadata = _this._config.clientMetadata; // TODO: verify behavior if this is override during signIn
|
|
1759
1765
|
user.getSession(function (err, result) { return __awaiter(_this, void 0, void 0, function () {
|
|
1760
|
-
var
|
|
1766
|
+
var cleanUpError_7;
|
|
1761
1767
|
var _this = this;
|
|
1762
1768
|
return __generator(this, function (_a) {
|
|
1763
1769
|
switch (_a.label) {
|
|
@@ -1773,8 +1779,8 @@ var AuthClass = /** @class */ (function () {
|
|
|
1773
1779
|
_a.sent();
|
|
1774
1780
|
return [3 /*break*/, 4];
|
|
1775
1781
|
case 3:
|
|
1776
|
-
|
|
1777
|
-
rej(new Error("Session is invalid due to: " + err.message + " and failed to clean up invalid session: " +
|
|
1782
|
+
cleanUpError_7 = _a.sent();
|
|
1783
|
+
rej(new Error("Session is invalid due to: " + err.message + " and failed to clean up invalid session: " + cleanUpError_7.message));
|
|
1778
1784
|
return [2 /*return*/];
|
|
1779
1785
|
case 4: return [2 /*return*/, rej(err)];
|
|
1780
1786
|
case 5:
|
|
@@ -1815,7 +1821,7 @@ var AuthClass = /** @class */ (function () {
|
|
|
1815
1821
|
});
|
|
1816
1822
|
};
|
|
1817
1823
|
AuthClass.prototype.oAuthSignOutRedirect = function (resolve, reject) {
|
|
1818
|
-
var isBrowser = core_1.
|
|
1824
|
+
var isBrowser = core_1.browserOrNode().isBrowser;
|
|
1819
1825
|
if (isBrowser) {
|
|
1820
1826
|
this.oAuthSignOutRedirectOrReject(reject);
|
|
1821
1827
|
}
|
|
@@ -1998,7 +2004,7 @@ var AuthClass = /** @class */ (function () {
|
|
|
1998
2004
|
*/
|
|
1999
2005
|
AuthClass.prototype.currentUserInfo = function () {
|
|
2000
2006
|
return __awaiter(this, void 0, void 0, function () {
|
|
2001
|
-
var source, user, attributes, userAttrs, credentials, e_12, info,
|
|
2007
|
+
var source, user, attributes, userAttrs, credentials, e_12, info, err_2, user;
|
|
2002
2008
|
return __generator(this, function (_a) {
|
|
2003
2009
|
switch (_a.label) {
|
|
2004
2010
|
case 0:
|
|
@@ -2039,8 +2045,8 @@ var AuthClass = /** @class */ (function () {
|
|
|
2039
2045
|
};
|
|
2040
2046
|
return [2 /*return*/, info];
|
|
2041
2047
|
case 8:
|
|
2042
|
-
|
|
2043
|
-
logger.error('currentUserInfo error',
|
|
2048
|
+
err_2 = _a.sent();
|
|
2049
|
+
logger.error('currentUserInfo error', err_2);
|
|
2044
2050
|
return [2 /*return*/, {}];
|
|
2045
2051
|
case 9:
|
|
2046
2052
|
if (source === 'federated') {
|
|
@@ -2121,7 +2127,7 @@ var AuthClass = /** @class */ (function () {
|
|
|
2121
2127
|
*/
|
|
2122
2128
|
AuthClass.prototype._handleAuthResponse = function (URL) {
|
|
2123
2129
|
return __awaiter(this, void 0, void 0, function () {
|
|
2124
|
-
var currentUrl, hasCodeOrError, hasTokenOrError, _a, accessToken, idToken, refreshToken, state, session, credentials, isCustomStateIncluded, currentUser, customState,
|
|
2130
|
+
var currentUrl, hasCodeOrError, hasTokenOrError, _a, accessToken, idToken, refreshToken, state, session, credentials, isCustomStateIncluded, currentUser, customState, err_3;
|
|
2125
2131
|
return __generator(this, function (_b) {
|
|
2126
2132
|
switch (_b.label) {
|
|
2127
2133
|
case 0:
|
|
@@ -2137,7 +2143,7 @@ var AuthClass = /** @class */ (function () {
|
|
|
2137
2143
|
throw new Error("OAuth responses require a User Pool defined in config");
|
|
2138
2144
|
}
|
|
2139
2145
|
dispatchAuthEvent('parsingCallbackUrl', { url: URL }, "The callback url is being parsed");
|
|
2140
|
-
currentUrl = URL || (core_1.
|
|
2146
|
+
currentUrl = URL || (core_1.browserOrNode().isBrowser ? window.location.href : '');
|
|
2141
2147
|
hasCodeOrError = !!(url_1.parse(currentUrl).query || '')
|
|
2142
2148
|
.split('&')
|
|
2143
2149
|
.map(function (entry) { return entry.split('='); })
|
|
@@ -2194,16 +2200,16 @@ var AuthClass = /** @class */ (function () {
|
|
|
2194
2200
|
//#endregion
|
|
2195
2201
|
return [2 /*return*/, credentials];
|
|
2196
2202
|
case 6:
|
|
2197
|
-
|
|
2198
|
-
logger.debug('Error in cognito hosted auth response',
|
|
2203
|
+
err_3 = _b.sent();
|
|
2204
|
+
logger.debug('Error in cognito hosted auth response', err_3);
|
|
2199
2205
|
// Just like a successful handling of `?code`, replace the window history to "dispose" of the `code`.
|
|
2200
2206
|
// Otherwise, reloading the page will throw errors as the `code` has already been spent.
|
|
2201
2207
|
if (window && typeof window.history !== 'undefined') {
|
|
2202
2208
|
window.history.replaceState({}, null, this._config.oauth.redirectSignIn);
|
|
2203
2209
|
}
|
|
2204
|
-
dispatchAuthEvent('signIn_failure',
|
|
2205
|
-
dispatchAuthEvent('cognitoHostedUI_failure',
|
|
2206
|
-
dispatchAuthEvent('customState_failure',
|
|
2210
|
+
dispatchAuthEvent('signIn_failure', err_3, "The OAuth response flow failed");
|
|
2211
|
+
dispatchAuthEvent('cognitoHostedUI_failure', err_3, "A failure occurred when returning to the Cognito Hosted UI");
|
|
2212
|
+
dispatchAuthEvent('customState_failure', err_3, "A failure occurred when returning state");
|
|
2207
2213
|
return [3 /*break*/, 7];
|
|
2208
2214
|
case 7: return [3 /*break*/, 9];
|
|
2209
2215
|
case 8:
|