Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

supertokens-website

Package Overview
Dependencies
Maintainers
1
Versions
129
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

supertokens-website - npm Package Compare versions

Comparing version 10.1.0 to 11.0.0

2

CHANGELOG.md

@@ -10,2 +10,4 @@ # Changelog

- Add the `ACCESS_TOKEN_PAYLOAD_UPDATED` event
## [10.1.0] - 2022-05-10

@@ -12,0 +14,0 @@

@@ -49,2 +49,3 @@ import { RecipeInterface, NormalisedInputType } from "./types";

}>;
export declare function onTokenUpdate(): void;
declare type IdRefreshTokenType = {

@@ -51,0 +52,0 @@ status: "NOT_EXISTS" | "MAY_EXIST";

77

lib/build/fetch.js

@@ -285,3 +285,3 @@ "use strict";

case 5:
return [2 /*return*/, JSON.parse(decodeURIComponent(escape(atob(frontToken))))];
return [2 /*return*/, parseFrontToken(frontToken)];
}

@@ -739,2 +739,8 @@ });

exports.onUnauthorisedResponse = onUnauthorisedResponse;
function onTokenUpdate() {
AuthHttpRequest.config.onHandleEvent({
action: "ACCESS_TOKEN_PAYLOAD_UPDATED"
});
}
exports.onTokenUpdate = onTokenUpdate;
// if tryRefresh is true & this token doesn't exist, we try and refresh the session

@@ -1122,33 +1128,33 @@ // else we return undefined.

exports.setAntiCSRF = setAntiCSRF;
function getFrontToken() {
function getFrontTokenFromCookie() {
return __awaiter(this, void 0, void 0, function() {
function getFrontTokenFromCookie() {
return __awaiter(this, void 0, void 0, function() {
var value, _a, parts, last, temp;
return __generator(this, function(_b) {
switch (_b.label) {
case 0:
_a = "; ";
return [
4 /*yield*/,
cookieHandler_1.default.getReferenceOrThrow().cookieHandler.getCookie()
];
case 1:
value = _a + _b.sent();
parts = value.split("; " + FRONT_TOKEN_NAME + "=");
if (parts.length >= 2) {
last = parts.pop();
if (last !== undefined) {
temp = last.split(";").shift();
if (temp === undefined) {
return [2 /*return*/, null];
}
return [2 /*return*/, temp];
}
var value, _a, parts, last, temp;
return __generator(this, function(_b) {
switch (_b.label) {
case 0:
_a = "; ";
return [4 /*yield*/, cookieHandler_1.default.getReferenceOrThrow().cookieHandler.getCookie()];
case 1:
value = _a + _b.sent();
parts = value.split("; " + FRONT_TOKEN_NAME + "=");
if (parts.length >= 2) {
last = parts.pop();
if (last !== undefined) {
temp = last.split(";").shift();
if (temp === undefined) {
return [2 /*return*/, null];
}
return [2 /*return*/, null];
return [2 /*return*/, temp];
}
}
});
});
}
return [2 /*return*/, null];
}
});
});
}
function parseFrontToken(frontToken) {
return JSON.parse(decodeURIComponent(escape(atob(frontToken))));
}
function getFrontToken() {
return __awaiter(this, void 0, void 0, function() {
var fromCookie;

@@ -1279,7 +1285,18 @@ return __generator(this, function(_a) {

}
var oldToken, oldPayload, newPayload;
return __generator(this, function(_a) {
switch (_a.label) {
case 0:
return [4 /*yield*/, getFrontTokenFromCookie()];
case 1:
oldToken = _a.sent();
if (oldToken !== null && frontToken !== undefined) {
oldPayload = parseFrontToken(oldToken).up;
newPayload = parseFrontToken(frontToken).up;
if (JSON.stringify(oldPayload) !== JSON.stringify(newPayload)) {
onTokenUpdate();
}
}
return [4 /*yield*/, setFrontTokenToCookie(frontToken, AuthHttpRequest.config.sessionScope)];
case 1:
case 2:
_a.sent();

@@ -1286,0 +1303,0 @@ return [2 /*return*/];

@@ -5,3 +5,3 @@ import OverrideableBuilder from "supertokens-js-override";

export declare type Event = {
action: "SIGN_OUT" | "REFRESH_SESSION" | "SESSION_CREATED";
action: "SIGN_OUT" | "REFRESH_SESSION" | "SESSION_CREATED" | "ACCESS_TOKEN_PAYLOAD_UPDATED";
} | {

@@ -8,0 +8,0 @@ action: "UNAUTHORISED";

@@ -1,2 +0,2 @@

export declare const package_version = "10.1.0";
export declare const package_version = "11.0.0";
export declare const supported_fdi: string[];

@@ -17,3 +17,3 @@ "use strict";

*/
exports.package_version = "10.1.0";
exports.package_version = "11.0.0";
exports.supported_fdi = ["1.8", "1.9", "1.10", "1.11", "1.12", "1.13"];
{
"name": "supertokens-website",
"version": "10.1.0",
"version": "11.0.0",
"description": "frontend sdk for website to be used for auth solution.",

@@ -25,2 +25,3 @@ "main": "index.js",

"puppeteer": "^11.0.0",
"sinon": "^13.0.2",
"size-limit": "^6.0.3",

@@ -76,2 +77,2 @@ "typedoc": "^0.22.5",

"homepage": "https://github.com/supertokens/supertokens-website#readme"
}
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc