@workos-inc/node 2.3.0 → 2.4.0
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/lib/sso/sso.d.ts
CHANGED
|
@@ -11,7 +11,7 @@ export declare class SSO {
|
|
|
11
11
|
private readonly workos;
|
|
12
12
|
constructor(workos: WorkOS);
|
|
13
13
|
deleteConnection(id: string): Promise<void>;
|
|
14
|
-
getAuthorizationURL({ connection, clientID, domain, organization, provider, redirectURI, state, }: AuthorizationURLOptions): string;
|
|
14
|
+
getAuthorizationURL({ connection, clientID, domain, domainHint, loginHint, organization, provider, redirectURI, state, }: AuthorizationURLOptions): string;
|
|
15
15
|
getConnection(id: string): Promise<Connection>;
|
|
16
16
|
getProfileAndToken({ code, clientID, }: GetProfileAndTokenOptions): Promise<ProfileAndToken>;
|
|
17
17
|
getProfile({ accessToken }: GetProfileOptions): Promise<Profile>;
|
package/lib/sso/sso.js
CHANGED
|
@@ -23,7 +23,7 @@ class SSO {
|
|
|
23
23
|
yield this.workos.delete(`/connections/${id}`);
|
|
24
24
|
});
|
|
25
25
|
}
|
|
26
|
-
getAuthorizationURL({ connection, clientID, domain, organization, provider, redirectURI, state, }) {
|
|
26
|
+
getAuthorizationURL({ connection, clientID, domain, domainHint, loginHint, organization, provider, redirectURI, state, }) {
|
|
27
27
|
if (!domain && !provider && !connection && !organization) {
|
|
28
28
|
throw new Error(`Incomplete arguments. Need to specify either a 'connection', 'organization', 'domain', or 'provider'.`);
|
|
29
29
|
}
|
|
@@ -34,6 +34,8 @@ class SSO {
|
|
|
34
34
|
connection,
|
|
35
35
|
organization,
|
|
36
36
|
domain,
|
|
37
|
+
domain_hint: domainHint,
|
|
38
|
+
login_hint: loginHint,
|
|
37
39
|
provider,
|
|
38
40
|
client_id: clientID,
|
|
39
41
|
redirect_uri: redirectURI,
|
package/lib/sso/sso.spec.js
CHANGED
|
@@ -103,6 +103,32 @@ describe('SSO', () => {
|
|
|
103
103
|
expect(url).toMatchSnapshot();
|
|
104
104
|
});
|
|
105
105
|
});
|
|
106
|
+
describe('with domainHint', () => {
|
|
107
|
+
it('generates an authorize url with the provided domain hint', () => {
|
|
108
|
+
const workos = new workos_1.WorkOS('sk_test_Sz3IQjepeSWaI4cMS4ms4sMuU');
|
|
109
|
+
const url = workos.sso.getAuthorizationURL({
|
|
110
|
+
domainHint: 'lyft.com',
|
|
111
|
+
connection: 'connection_123',
|
|
112
|
+
clientID: 'proj_123',
|
|
113
|
+
redirectURI: 'example.com/sso/workos/callback',
|
|
114
|
+
state: 'custom state',
|
|
115
|
+
});
|
|
116
|
+
expect(url).toMatchInlineSnapshot(`"https://api.workos.com/sso/authorize?client_id=proj_123&connection=connection_123&domain_hint=lyft.com&redirect_uri=example.com%2Fsso%2Fworkos%2Fcallback&response_type=code&state=custom%20state"`);
|
|
117
|
+
});
|
|
118
|
+
});
|
|
119
|
+
describe('with loginHint', () => {
|
|
120
|
+
it('generates an authorize url with the provided login hint', () => {
|
|
121
|
+
const workos = new workos_1.WorkOS('sk_test_Sz3IQjepeSWaI4cMS4ms4sMuU');
|
|
122
|
+
const url = workos.sso.getAuthorizationURL({
|
|
123
|
+
loginHint: 'foo@workos.com',
|
|
124
|
+
connection: 'connection_123',
|
|
125
|
+
clientID: 'proj_123',
|
|
126
|
+
redirectURI: 'example.com/sso/workos/callback',
|
|
127
|
+
state: 'custom state',
|
|
128
|
+
});
|
|
129
|
+
expect(url).toMatchInlineSnapshot(`"https://api.workos.com/sso/authorize?client_id=proj_123&connection=connection_123&login_hint=foo%40workos.com&redirect_uri=example.com%2Fsso%2Fworkos%2Fcallback&response_type=code&state=custom%20state"`);
|
|
130
|
+
});
|
|
131
|
+
});
|
|
106
132
|
});
|
|
107
133
|
describe('getProfileAndToken', () => {
|
|
108
134
|
describe('with all information provided', () => {
|
package/lib/workos.js
CHANGED
|
@@ -22,7 +22,7 @@ const passwordless_1 = require("./passwordless/passwordless");
|
|
|
22
22
|
const portal_1 = require("./portal/portal");
|
|
23
23
|
const sso_1 = require("./sso/sso");
|
|
24
24
|
const webhooks_1 = require("./webhooks/webhooks");
|
|
25
|
-
const VERSION = '2.
|
|
25
|
+
const VERSION = '2.4.0';
|
|
26
26
|
const DEFAULT_HOSTNAME = 'api.workos.com';
|
|
27
27
|
class WorkOS {
|
|
28
28
|
constructor(key, options = {}) {
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "2.
|
|
2
|
+
"version": "2.4.0",
|
|
3
3
|
"name": "@workos-inc/node",
|
|
4
4
|
"author": "WorkOS",
|
|
5
5
|
"description": "A Node wrapper for the WorkOS API",
|
|
@@ -43,11 +43,11 @@
|
|
|
43
43
|
"@types/node": "14.18.0",
|
|
44
44
|
"@types/pluralize": "0.0.29",
|
|
45
45
|
"axios-mock-adapter": "1.20.0",
|
|
46
|
-
"jest": "27.4.
|
|
46
|
+
"jest": "27.4.5",
|
|
47
47
|
"prettier": "2.5.1",
|
|
48
48
|
"supertest": "6.1.6",
|
|
49
49
|
"ts-jest": "27.1.1",
|
|
50
50
|
"tslint": "6.1.3",
|
|
51
|
-
"typescript": "4.5.
|
|
51
|
+
"typescript": "4.5.4"
|
|
52
52
|
}
|
|
53
53
|
}
|