supertokens-website
Advanced tools
Comparing version 14.0.2 to 14.0.3
@@ -10,2 +10,8 @@ # Changelog | ||
## [14.0.3] - 2022-11-24 | ||
### Fixes | ||
- doesSessionExist now refreshes the session if it detects an expired access token | ||
## [14.0.2] - 2022-10-24 | ||
@@ -12,0 +18,0 @@ |
@@ -272,2 +272,3 @@ "use strict"; | ||
return __awaiter(this, void 0, void 0, function() { | ||
var tokenInfo, preRequestIdToken, refresh; | ||
return __generator(this, function(_a) { | ||
@@ -277,5 +278,21 @@ switch (_a.label) { | ||
(0, logger_1.logDebugMessage)("doesSessionExist: called"); | ||
return [4 /*yield*/, (0, fetch_1.getIdRefreshToken)(true)]; | ||
return [4 /*yield*/, fetch_1.FrontToken.getTokenInfo()]; | ||
case 1: | ||
return [2 /*return*/, _a.sent().status === "EXISTS"]; | ||
tokenInfo = _a.sent(); | ||
// The above includes getIdRefreshToken(true), which would call refresh if the FE cookies were cleared for some reason | ||
if (tokenInfo === undefined) { | ||
(0, logger_1.logDebugMessage)("doesSessionExist: access token does not exist locally"); | ||
return [2 /*return*/, false]; | ||
} | ||
if (!(tokenInfo.ate < Date.now())) return [3 /*break*/, 4]; | ||
(0, logger_1.logDebugMessage)("doesSessionExist: access token expired. Refreshing session"); | ||
return [4 /*yield*/, (0, fetch_1.getIdRefreshToken)(false)]; | ||
case 2: | ||
preRequestIdToken = _a.sent(); | ||
return [4 /*yield*/, (0, fetch_1.onUnauthorisedResponse)(preRequestIdToken)]; | ||
case 3: | ||
refresh = _a.sent(); | ||
return [2 /*return*/, refresh.result === "RETRY"]; | ||
case 4: | ||
return [2 /*return*/, true]; | ||
} | ||
@@ -282,0 +299,0 @@ }); |
@@ -1,2 +0,2 @@ | ||
export declare const package_version = "14.0.2"; | ||
export declare const package_version = "14.0.3"; | ||
export declare const supported_fdi: string[]; |
@@ -18,3 +18,3 @@ "use strict"; | ||
*/ | ||
exports.package_version = "14.0.2"; | ||
exports.package_version = "14.0.3"; | ||
exports.supported_fdi = ["1.8", "1.9", "1.10", "1.11", "1.12", "1.13", "1.14", "1.15"]; |
{ | ||
"name": "supertokens-website", | ||
"version": "14.0.2", | ||
"version": "14.0.3", | ||
"description": "frontend sdk for website to be used for auth solution.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
345044
6876