@workos-inc/node
Advanced tools
Comparing version 7.19.0 to 7.20.0
@@ -90,3 +90,10 @@ import { AutoPaginatable } from '../common/utils/pagination'; | ||
}): string; | ||
/** | ||
* getLogoutUrlFromSessionCookie takes in session cookie data, unseals the cookie, decodes the JWT claims, | ||
* and uses the session ID to generate the logout URL. | ||
* | ||
* Use this over `getLogoutUrl` if you'd like to the SDK to handle session cookies for you. | ||
*/ | ||
getLogoutUrlFromSessionCookie({ sessionData, cookiePassword, }: SessionHandlerOptions): Promise<string>; | ||
getJwksUrl(clientId: string): string; | ||
} |
@@ -503,2 +503,21 @@ "use strict"; | ||
} | ||
/** | ||
* getLogoutUrlFromSessionCookie takes in session cookie data, unseals the cookie, decodes the JWT claims, | ||
* and uses the session ID to generate the logout URL. | ||
* | ||
* Use this over `getLogoutUrl` if you'd like to the SDK to handle session cookies for you. | ||
*/ | ||
getLogoutUrlFromSessionCookie({ sessionData, cookiePassword = process.env.WORKOS_COOKIE_PASSWORD, }) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const authenticationResponse = yield this.authenticateWithSessionCookie({ | ||
sessionData, | ||
cookiePassword, | ||
}); | ||
if (!authenticationResponse.authenticated) { | ||
const { reason } = authenticationResponse; | ||
throw new Error(`Failed to extract session ID for logout URL: ${reason}`); | ||
} | ||
return this.getLogoutUrl({ sessionId: authenticationResponse.sessionId }); | ||
}); | ||
} | ||
getJwksUrl(clientId) { | ||
@@ -505,0 +524,0 @@ if (!clientId) { |
@@ -30,3 +30,3 @@ "use strict"; | ||
const fetch_client_1 = require("./common/net/fetch-client"); | ||
const VERSION = '7.19.0'; | ||
const VERSION = '7.20.0'; | ||
const DEFAULT_HOSTNAME = 'api.workos.com'; | ||
@@ -38,3 +38,2 @@ const HEADER_AUTHORIZATION = 'Authorization'; | ||
constructor(key, options = {}) { | ||
var _a; | ||
this.key = key; | ||
@@ -54,3 +53,6 @@ this.options = options; | ||
// process might be undefined in some environments | ||
this.key = process === null || process === void 0 ? void 0 : process.env.WORKOS_API_KEY; | ||
this.key = | ||
typeof process !== 'undefined' | ||
? process === null || process === void 0 ? void 0 : process.env.WORKOS_API_KEY | ||
: undefined; | ||
if (!this.key) { | ||
@@ -63,3 +65,6 @@ throw new exceptions_1.NoApiKeyProvidedException(); | ||
} | ||
this.clientId = (_a = this.options.clientId) !== null && _a !== void 0 ? _a : process === null || process === void 0 ? void 0 : process.env.WORKOS_CLIENT_ID; | ||
this.clientId = this.options.clientId; | ||
if (!this.clientId && typeof process !== 'undefined') { | ||
this.clientId = process === null || process === void 0 ? void 0 : process.env.WORKOS_CLIENT_ID; | ||
} | ||
const protocol = this.options.https ? 'https' : 'http'; | ||
@@ -66,0 +71,0 @@ const apiHostname = this.options.apiHostname || DEFAULT_HOSTNAME; |
{ | ||
"version": "7.19.0", | ||
"version": "7.20.0", | ||
"name": "@workos-inc/node", | ||
@@ -4,0 +4,0 @@ "author": "WorkOS", |
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
625400
13501
12