@workos-inc/node
Advanced tools
Comparing version 2.2.0 to 2.3.0
export interface AuthorizationURLOptions { | ||
clientID: string; | ||
connection?: string; | ||
organization?: string; | ||
/** | ||
* @deprecated Please use `organization` instead. | ||
*/ | ||
domain?: string; | ||
@@ -5,0 +9,0 @@ provider?: string; |
@@ -14,3 +14,3 @@ import { List } from '../common/interfaces/list.interface'; | ||
deleteConnection(id: string): Promise<void>; | ||
getAuthorizationURL({ connection, clientID, domain, provider, redirectURI, state, }: AuthorizationURLOptions): string; | ||
getAuthorizationURL({ connection, clientID, domain, organization, provider, redirectURI, state, }: AuthorizationURLOptions): string; | ||
getConnection(id: string): Promise<Connection>; | ||
@@ -17,0 +17,0 @@ getProfileAndToken({ code, clientID, }: GetProfileAndTokenOptions): Promise<ProfileAndToken>; |
@@ -26,8 +26,12 @@ "use strict"; | ||
} | ||
getAuthorizationURL({ connection, clientID, domain, provider, redirectURI, state, }) { | ||
if (!domain && !provider && !connection) { | ||
throw new Error(`Incomplete arguments. Need to specify either a 'connection', 'domain', or 'provider'.`); | ||
getAuthorizationURL({ connection, clientID, domain, organization, provider, redirectURI, state, }) { | ||
if (!domain && !provider && !connection && !organization) { | ||
throw new Error(`Incomplete arguments. Need to specify either a 'connection', 'organization', 'domain', or 'provider'.`); | ||
} | ||
if (domain) { | ||
this.workos.emitWarning('The `domain` parameter for `getAuthorizationURL` is deprecated. Please use `organization` instead.'); | ||
} | ||
const query = query_string_1.default.stringify({ | ||
connection, | ||
organization, | ||
domain, | ||
@@ -34,0 +38,0 @@ provider, |
@@ -68,2 +68,15 @@ "use strict"; | ||
}); | ||
describe('with an `organization`', () => { | ||
it('generates an authorization URL with the organization', () => { | ||
const workos = new workos_1.WorkOS('sk_test_Sz3IQjepeSWaI4cMS4ms4sMuU', { | ||
apiHostname: 'api.workos.dev', | ||
}); | ||
const url = workos.sso.getAuthorizationURL({ | ||
organization: 'organization_123', | ||
clientID: 'proj_123', | ||
redirectURI: 'example.com/sso/workos/callback', | ||
}); | ||
expect(url).toMatchSnapshot(); | ||
}); | ||
}); | ||
describe('with a custom api hostname', () => { | ||
@@ -70,0 +83,0 @@ it('generates an authorize url with the custom api hostname', () => { |
@@ -10,3 +10,3 @@ "use strict"; | ||
class Webhooks { | ||
constructEvent({ payload, sigHeader, secret, tolerance = 180, }) { | ||
constructEvent({ payload, sigHeader, secret, tolerance = 180000, }) { | ||
const options = { payload, sigHeader, secret, tolerance }; | ||
@@ -17,3 +17,3 @@ this.verifyHeader(options); | ||
} | ||
verifyHeader({ payload, sigHeader, secret, tolerance = 180, }) { | ||
verifyHeader({ payload, sigHeader, secret, tolerance = 180000, }) { | ||
const [timestamp, signatureHash] = this.getTimestampAndSignatureHash(sigHeader); | ||
@@ -20,0 +20,0 @@ if (!signatureHash || Object.keys(signatureHash).length === 0) { |
@@ -25,3 +25,3 @@ "use strict"; | ||
const webhooks_1 = require("./webhooks/webhooks"); | ||
const VERSION = '2.2.0'; | ||
const VERSION = '2.3.0'; | ||
const DEFAULT_HOSTNAME = 'api.workos.com'; | ||
@@ -28,0 +28,0 @@ class WorkOS { |
{ | ||
"version": "2.2.0", | ||
"version": "2.3.0", | ||
"name": "@workos-inc/node", | ||
@@ -12,3 +12,3 @@ "author": "WorkOS", | ||
"volta": { | ||
"node": "14.18.1", | ||
"node": "14.18.2", | ||
"yarn": "1.22.17" | ||
@@ -43,13 +43,13 @@ }, | ||
"devDependencies": { | ||
"@types/jest": "27.0.2", | ||
"@types/node": "14.17.33", | ||
"@types/jest": "27.0.3", | ||
"@types/node": "14.18.0", | ||
"@types/pluralize": "0.0.29", | ||
"axios-mock-adapter": "1.20.0", | ||
"jest": "27.3.1", | ||
"prettier": "2.4.1", | ||
"jest": "27.4.4", | ||
"prettier": "2.5.1", | ||
"supertest": "6.1.6", | ||
"ts-jest": "27.0.7", | ||
"ts-jest": "27.1.1", | ||
"tslint": "6.1.3", | ||
"typescript": "4.4.4" | ||
"typescript": "4.5.3" | ||
} | ||
} |
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
127123
2765