@workos-inc/node 3.9.1 → 5.0.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/common/interfaces/event.interface.d.ts +45 -3
- package/lib/common/serializers/event.serializer.js +9 -0
- package/lib/directory-sync/directory-sync.spec.js +2 -2
- package/lib/directory-sync/interfaces/directory-user.interface.d.ts +14 -14
- package/lib/directory-sync/interfaces/directory.interface.d.ts +1 -1
- package/lib/index.d.ts +1 -2
- package/lib/index.js +1 -2
- package/lib/mfa/interfaces/challenge.interface.d.ts +2 -2
- package/lib/mfa/interfaces/factor.interface.d.ts +23 -3
- package/lib/mfa/interfaces/totp.interface.d.ts +4 -0
- package/lib/mfa/mfa.d.ts +2 -2
- package/lib/mfa/mfa.js +1 -1
- package/lib/mfa/mfa.spec.js +0 -6
- package/lib/mfa/serializers/factor.serializer.d.ts +2 -1
- package/lib/mfa/serializers/factor.serializer.js +3 -1
- package/lib/mfa/serializers/totp.serializer.d.ts +2 -1
- package/lib/mfa/serializers/totp.serializer.js +17 -8
- package/lib/sso/interfaces/authorization-url-options.interface.d.ts +2 -2
- package/lib/sso/interfaces/get-profile-and-token-options.interface.d.ts +1 -1
- package/lib/sso/sso.d.ts +2 -2
- package/lib/sso/sso.js +5 -5
- package/lib/sso/sso.spec.js +30 -30
- package/lib/user-management/fixtures/invitation.json +13 -0
- package/lib/{users → user-management}/fixtures/list-factors.json +0 -3
- package/lib/user-management/fixtures/list-invitations.json +22 -0
- package/lib/user-management/fixtures/list-organization-memberships.json +17 -0
- package/lib/user-management/fixtures/organization-membership.json +8 -0
- package/lib/user-management/interfaces/authenticate-with-code-options.interface.d.ts +11 -0
- package/lib/user-management/interfaces/authenticate-with-email-verification-options.interface.d.ts +13 -0
- package/lib/user-management/interfaces/authenticate-with-magic-auth-options.interface.d.ts +15 -0
- package/lib/user-management/interfaces/authenticate-with-options-base.interface.d.ts +11 -0
- package/lib/user-management/interfaces/authenticate-with-organization-selection.interface.d.ts +13 -0
- package/lib/user-management/interfaces/authenticate-with-password-options.interface.d.ts +13 -0
- package/lib/{users → user-management}/interfaces/authenticate-with-totp-options.interface.d.ts +3 -9
- package/lib/{users → user-management}/interfaces/authentication-response.interface.d.ts +2 -0
- package/lib/user-management/interfaces/authorization-url-options.interface.d.ts +10 -0
- package/lib/user-management/interfaces/create-organization-membership-options.interface.d.ts +8 -0
- package/lib/{users → user-management}/interfaces/enroll-auth-factor.interface.d.ts +4 -4
- package/lib/user-management/interfaces/factor.interface.d.ts +37 -0
- package/lib/{users → user-management}/interfaces/index.d.ts +2 -5
- package/lib/{users → user-management}/interfaces/index.js +2 -5
- package/lib/user-management/interfaces/invitation.interface.d.ts +26 -0
- package/lib/user-management/interfaces/list-invitations-options.interface.d.ts +9 -0
- package/lib/user-management/interfaces/list-organization-memberships-options.interface.d.ts +9 -0
- package/lib/{users → user-management}/interfaces/list-users-options.interface.d.ts +5 -1
- package/lib/user-management/interfaces/organization-membership.interface.d.ts +16 -0
- package/lib/user-management/interfaces/send-invitation-options.interface.d.ts +12 -0
- package/lib/user-management/interfaces/send-password-reset-email-options.interface.d.ts +8 -0
- package/lib/{users → user-management}/interfaces/update-user-options.interface.d.ts +6 -0
- package/lib/user-management/interfaces/update-user-password-options.interface.js +2 -0
- package/lib/user-management/interfaces/user.interface.js +2 -0
- package/lib/user-management/interfaces/verify-email-options.interface.d.ts +7 -0
- package/lib/user-management/interfaces/verify-email-options.interface.js +2 -0
- package/lib/user-management/serializers/authenticate-with-email-verification.serializer.d.ts +2 -0
- package/lib/user-management/serializers/authenticate-with-email-verification.serializer.js +13 -0
- package/lib/{users → user-management}/serializers/authenticate-with-magic-auth-options.serializer.js +2 -1
- package/lib/user-management/serializers/authenticate-with-organization-selection-options.serializer.d.ts +2 -0
- package/lib/user-management/serializers/authenticate-with-organization-selection-options.serializer.js +13 -0
- package/lib/{users → user-management}/serializers/authentication-response.serializer.js +1 -0
- package/lib/user-management/serializers/create-organization-membership-options.serializer.d.ts +2 -0
- package/lib/user-management/serializers/create-organization-membership-options.serializer.js +8 -0
- package/lib/user-management/serializers/factor.serializer.d.ts +3 -0
- package/lib/user-management/serializers/factor.serializer.js +24 -0
- package/lib/{users → user-management}/serializers/index.d.ts +1 -0
- package/lib/{users → user-management}/serializers/index.js +1 -0
- package/lib/user-management/serializers/invitation.serializer.d.ts +2 -0
- package/lib/user-management/serializers/invitation.serializer.js +17 -0
- package/lib/user-management/serializers/list-invitations-options.serializer.d.ts +2 -0
- package/lib/user-management/serializers/list-invitations-options.serializer.js +12 -0
- package/lib/user-management/serializers/list-organization-memberships-options.serializer.d.ts +2 -0
- package/lib/user-management/serializers/list-organization-memberships-options.serializer.js +12 -0
- package/lib/user-management/serializers/list-users-options.serializer.d.ts +2 -0
- package/lib/user-management/serializers/list-users-options.serializer.js +12 -0
- package/lib/user-management/serializers/organization-membership.serializer.d.ts +2 -0
- package/lib/user-management/serializers/organization-membership.serializer.js +12 -0
- package/lib/user-management/serializers/send-invitation-options.serializer.d.ts +2 -0
- package/lib/user-management/serializers/send-invitation-options.serializer.js +10 -0
- package/lib/user-management/serializers/send-password-reset-email.serializer.d.ts +2 -0
- package/lib/user-management/serializers/send-password-reset-email.serializer.js +8 -0
- package/lib/{users → user-management}/serializers/update-user-options.serializer.js +3 -0
- package/lib/user-management/user-management.d.ts +54 -0
- package/lib/user-management/user-management.js +215 -0
- package/lib/user-management/user-management.spec.js +745 -0
- package/lib/workos.d.ts +2 -4
- package/lib/workos.js +3 -5
- package/package.json +1 -1
- package/lib/audit-trail/audit-trail.d.ts +0 -12
- package/lib/audit-trail/audit-trail.js +0 -31
- package/lib/audit-trail/audit-trail.spec.js +0 -183
- package/lib/audit-trail/interfaces/create-event-options.interface.d.ts +0 -3
- package/lib/audit-trail/interfaces/event-options.interface.d.ts +0 -14
- package/lib/audit-trail/interfaces/event.interface.d.ts +0 -23
- package/lib/audit-trail/interfaces/index.d.ts +0 -4
- package/lib/audit-trail/interfaces/list-events-options.interface.d.ts +0 -16
- package/lib/users/interfaces/add-user-to-organization-options.interface.d.ts +0 -7
- package/lib/users/interfaces/authenticate-with-code-options.interface.d.ts +0 -17
- package/lib/users/interfaces/authenticate-with-magic-auth-options.interface.d.ts +0 -19
- package/lib/users/interfaces/authenticate-with-password-options.interface.d.ts +0 -19
- package/lib/users/interfaces/delete-user-options.interface.d.ts +0 -3
- package/lib/users/interfaces/remove-user-from-organization-options.interface.d.ts +0 -4
- package/lib/users/interfaces/send-password-reset-options.interface.d.ts +0 -17
- package/lib/users/interfaces/verify-email-code-options.interface.d.ts +0 -7
- package/lib/users/serializers/send-password-reset-email.serializer.d.ts +0 -3
- package/lib/users/serializers/send-password-reset-email.serializer.js +0 -14
- package/lib/users/users.d.ts +0 -38
- package/lib/users/users.js +0 -140
- package/lib/users/users.spec.d.ts +0 -1
- package/lib/users/users.spec.js +0 -462
- /package/lib/{users → user-management}/fixtures/list-users.json +0 -0
- /package/lib/{users → user-management}/fixtures/user.json +0 -0
- /package/lib/{users → user-management}/interfaces/authenticate-with-code-options.interface.js +0 -0
- /package/lib/{audit-trail/interfaces/create-event-options.interface.js → user-management/interfaces/authenticate-with-email-verification-options.interface.js} +0 -0
- /package/lib/{users → user-management}/interfaces/authenticate-with-magic-auth-options.interface.js +0 -0
- /package/lib/{audit-trail/interfaces/event-options.interface.js → user-management/interfaces/authenticate-with-options-base.interface.js} +0 -0
- /package/lib/{audit-trail/interfaces/event.interface.js → user-management/interfaces/authenticate-with-organization-selection.interface.js} +0 -0
- /package/lib/{users → user-management}/interfaces/authenticate-with-password-options.interface.js +0 -0
- /package/lib/{users → user-management}/interfaces/authenticate-with-totp-options.interface.js +0 -0
- /package/lib/{users → user-management}/interfaces/authentication-response.interface.js +0 -0
- /package/lib/{audit-trail/interfaces/index.js → user-management/interfaces/authorization-url-options.interface.js} +0 -0
- /package/lib/{audit-trail/interfaces/list-events-options.interface.js → user-management/interfaces/create-organization-membership-options.interface.js} +0 -0
- /package/lib/{users → user-management}/interfaces/create-user-options.interface.d.ts +0 -0
- /package/lib/{users → user-management}/interfaces/create-user-options.interface.js +0 -0
- /package/lib/{users → user-management}/interfaces/enroll-auth-factor.interface.js +0 -0
- /package/lib/{users/interfaces/add-user-to-organization-options.interface.js → user-management/interfaces/factor.interface.js} +0 -0
- /package/lib/{users/interfaces/delete-user-options.interface.js → user-management/interfaces/invitation.interface.js} +0 -0
- /package/lib/{users → user-management}/interfaces/list-auth-factors-options.interface.d.ts +0 -0
- /package/lib/{users → user-management}/interfaces/list-auth-factors-options.interface.js +0 -0
- /package/lib/{users/interfaces/list-users-options.interface.js → user-management/interfaces/list-invitations-options.interface.js} +0 -0
- /package/lib/{users/interfaces/remove-user-from-organization-options.interface.js → user-management/interfaces/list-organization-memberships-options.interface.js} +0 -0
- /package/lib/{users/interfaces/reset-password-options.interface.js → user-management/interfaces/list-users-options.interface.js} +0 -0
- /package/lib/{users/interfaces/send-magic-auth-code-options.interface.js → user-management/interfaces/organization-membership.interface.js} +0 -0
- /package/lib/{users → user-management}/interfaces/reset-password-options.interface.d.ts +0 -0
- /package/lib/{users/interfaces/send-password-reset-options.interface.js → user-management/interfaces/reset-password-options.interface.js} +0 -0
- /package/lib/{users/interfaces/send-verification-email-options.js → user-management/interfaces/send-invitation-options.interface.js} +0 -0
- /package/lib/{users → user-management}/interfaces/send-magic-auth-code-options.interface.d.ts +0 -0
- /package/lib/{users/interfaces/update-user-options.interface.js → user-management/interfaces/send-magic-auth-code-options.interface.js} +0 -0
- /package/lib/{users/interfaces/update-user-password-options.interface.js → user-management/interfaces/send-password-reset-email-options.interface.js} +0 -0
- /package/lib/{users → user-management}/interfaces/send-verification-email-options.d.ts +0 -0
- /package/lib/{users/interfaces/user.interface.js → user-management/interfaces/send-verification-email-options.js} +0 -0
- /package/lib/{users/interfaces/verify-email-code-options.interface.js → user-management/interfaces/update-user-options.interface.js} +0 -0
- /package/lib/{users → user-management}/interfaces/update-user-password-options.interface.d.ts +0 -0
- /package/lib/{users → user-management}/interfaces/user.interface.d.ts +0 -0
- /package/lib/{users → user-management}/serializers/authenticate-with-code-options.serializer.d.ts +0 -0
- /package/lib/{users → user-management}/serializers/authenticate-with-code-options.serializer.js +0 -0
- /package/lib/{users → user-management}/serializers/authenticate-with-magic-auth-options.serializer.d.ts +0 -0
- /package/lib/{users → user-management}/serializers/authenticate-with-password-options.serializer.d.ts +0 -0
- /package/lib/{users → user-management}/serializers/authenticate-with-password-options.serializer.js +0 -0
- /package/lib/{users → user-management}/serializers/authenticate-with-totp-options.serializer.d.ts +0 -0
- /package/lib/{users → user-management}/serializers/authenticate-with-totp-options.serializer.js +0 -0
- /package/lib/{users → user-management}/serializers/authentication-response.serializer.d.ts +0 -0
- /package/lib/{users → user-management}/serializers/create-user-options.serializer.d.ts +0 -0
- /package/lib/{users → user-management}/serializers/create-user-options.serializer.js +0 -0
- /package/lib/{users → user-management}/serializers/enroll-auth-factor-options.serializer.d.ts +0 -0
- /package/lib/{users → user-management}/serializers/enroll-auth-factor-options.serializer.js +0 -0
- /package/lib/{users → user-management}/serializers/reset-password-options.serializer.d.ts +0 -0
- /package/lib/{users → user-management}/serializers/reset-password-options.serializer.js +0 -0
- /package/lib/{users → user-management}/serializers/send-magic-auth-code-options.serializer.d.ts +0 -0
- /package/lib/{users → user-management}/serializers/send-magic-auth-code-options.serializer.js +0 -0
- /package/lib/{users → user-management}/serializers/update-user-options.serializer.d.ts +0 -0
- /package/lib/{users → user-management}/serializers/update-user-password-options.serializer.d.ts +0 -0
- /package/lib/{users → user-management}/serializers/update-user-password-options.serializer.js +0 -0
- /package/lib/{users → user-management}/serializers/user.serializer.d.ts +0 -0
- /package/lib/{users → user-management}/serializers/user.serializer.js +0 -0
- /package/lib/{audit-trail/audit-trail.spec.d.ts → user-management/user-management.spec.d.ts} +0 -0
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { DirectoryUser, DirectoryUserResponse, DirectoryGroup, DirectoryGroupResponse, EventDirectory, EventDirectoryResponse } from '../../directory-sync/interfaces';
|
|
2
2
|
import { Connection, ConnectionResponse } from '../../sso/interfaces';
|
|
3
|
+
import { User, UserResponse } from '../../user-management/interfaces';
|
|
4
|
+
import { OrganizationMembership, OrganizationMembershipResponse } from '../../user-management/interfaces/organization-membership.interface';
|
|
3
5
|
export interface EventBase {
|
|
4
6
|
id: string;
|
|
5
7
|
createdAt: string;
|
|
@@ -136,7 +138,47 @@ export interface DsyncUserUpdatedEventResponse extends EventResponseBase {
|
|
|
136
138
|
event: 'dsync.user.updated';
|
|
137
139
|
data: DirectoryUserResponse & Record<'previous_attributes', any>;
|
|
138
140
|
}
|
|
139
|
-
export
|
|
140
|
-
|
|
141
|
-
|
|
141
|
+
export interface UserCreatedEvent extends EventBase {
|
|
142
|
+
event: 'user.created';
|
|
143
|
+
data: User;
|
|
144
|
+
}
|
|
145
|
+
export interface UserCreatedEventResponse extends EventResponseBase {
|
|
146
|
+
event: 'user.created';
|
|
147
|
+
data: UserResponse;
|
|
148
|
+
}
|
|
149
|
+
export interface UserUpdatedEvent extends EventBase {
|
|
150
|
+
event: 'user.updated';
|
|
151
|
+
data: User;
|
|
152
|
+
}
|
|
153
|
+
export interface UserUpdatedEventResponse extends EventResponseBase {
|
|
154
|
+
event: 'user.updated';
|
|
155
|
+
data: UserResponse;
|
|
156
|
+
}
|
|
157
|
+
export interface UserDeletedEvent extends EventBase {
|
|
158
|
+
event: 'user.deleted';
|
|
159
|
+
data: User;
|
|
160
|
+
}
|
|
161
|
+
export interface UserDeletedEventResponse extends EventResponseBase {
|
|
162
|
+
event: 'user.deleted';
|
|
163
|
+
data: UserResponse;
|
|
164
|
+
}
|
|
165
|
+
export interface OrganizationMembershipAdded extends EventBase {
|
|
166
|
+
event: 'organization_membership.added';
|
|
167
|
+
data: OrganizationMembership;
|
|
168
|
+
}
|
|
169
|
+
export interface OrganizationMembershipAddedResponse extends EventResponseBase {
|
|
170
|
+
event: 'organization_membership.added';
|
|
171
|
+
data: OrganizationMembershipResponse;
|
|
172
|
+
}
|
|
173
|
+
export interface OrganizationMembershipRemoved extends EventBase {
|
|
174
|
+
event: 'organization_membership.removed';
|
|
175
|
+
data: OrganizationMembership;
|
|
176
|
+
}
|
|
177
|
+
export interface OrganizationMembershipRemovedResponse extends EventResponseBase {
|
|
178
|
+
event: 'organization_membership.removed';
|
|
179
|
+
data: OrganizationMembershipResponse;
|
|
180
|
+
}
|
|
181
|
+
export type Event = ConnectionActivatedEvent | ConnectionDeactivatedEvent | ConnectionDeletedEvent | DsyncActivatedEvent | DsyncDeactivatedEvent | DsyncDeletedEvent | DsyncGroupCreatedEvent | DsyncGroupUpdatedEvent | DsyncGroupDeletedEvent | DsyncGroupUserAddedEvent | DsyncGroupUserRemovedEvent | DsyncUserCreatedEvent | DsyncUserUpdatedEvent | DsyncUserDeletedEvent | UserCreatedEvent | UserUpdatedEvent | UserDeletedEvent | OrganizationMembershipAdded | OrganizationMembershipRemoved;
|
|
182
|
+
export type EventResponse = ConnectionActivatedEventResponse | ConnectionDeactivatedEventResponse | ConnectionDeletedEventResponse | DsyncActivatedEventResponse | DsyncDeactivatedEventResponse | DsyncDeletedEventResponse | DsyncGroupCreatedEventResponse | DsyncGroupUpdatedEventResponse | DsyncGroupDeletedEventResponse | DsyncGroupUserAddedEventResponse | DsyncGroupUserRemovedEventResponse | DsyncUserCreatedEventResponse | DsyncUserUpdatedEventResponse | DsyncUserDeletedEventResponse | UserCreatedEventResponse | UserUpdatedEventResponse | UserDeletedEventResponse | OrganizationMembershipAddedResponse | OrganizationMembershipRemovedResponse;
|
|
183
|
+
export type EventName = 'connection.activated' | 'connection.deactivated' | 'connection.deleted' | 'dsync.activated' | 'dsync.deactivated' | 'dsync.deleted' | 'dsync.group.created' | 'dsync.group.deleted' | 'dsync.group.updated' | 'dsync.group.user_added' | 'dsync.group.user_removed' | 'dsync.user.created' | 'dsync.user.deleted' | 'dsync.user.updated' | 'user.created' | 'user.updated' | 'user.deleted' | 'organization_membership.added' | 'organization_membership.removed';
|
|
142
184
|
export {};
|
|
@@ -3,6 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.deserializeEvent = void 0;
|
|
4
4
|
const serializers_1 = require("../../directory-sync/serializers");
|
|
5
5
|
const serializers_2 = require("../../sso/serializers");
|
|
6
|
+
const serializers_3 = require("../../user-management/serializers");
|
|
7
|
+
const organization_membership_serializer_1 = require("../../user-management/serializers/organization-membership.serializer");
|
|
6
8
|
const deserializeEvent = (event) => {
|
|
7
9
|
const eventBase = {
|
|
8
10
|
id: event.id,
|
|
@@ -35,6 +37,13 @@ const deserializeEvent = (event) => {
|
|
|
35
37
|
return Object.assign(Object.assign({}, eventBase), { event: event.event, data: (0, serializers_1.deserializeDirectoryUser)(event.data) });
|
|
36
38
|
case 'dsync.user.updated':
|
|
37
39
|
return Object.assign(Object.assign({}, eventBase), { event: event.event, data: (0, serializers_1.deserializeUpdatedEventDirectoryUser)(event.data) });
|
|
40
|
+
case 'user.created':
|
|
41
|
+
case 'user.updated':
|
|
42
|
+
case 'user.deleted':
|
|
43
|
+
return Object.assign(Object.assign({}, eventBase), { event: event.event, data: (0, serializers_3.deserializeUser)(event.data) });
|
|
44
|
+
case 'organization_membership.added':
|
|
45
|
+
case 'organization_membership.removed':
|
|
46
|
+
return Object.assign(Object.assign({}, eventBase), { event: event.event, data: (0, organization_membership_serializer_1.deserializeOrganizationMembership)(event.data) });
|
|
38
47
|
}
|
|
39
48
|
};
|
|
40
49
|
exports.deserializeEvent = deserializeEvent;
|
|
@@ -28,7 +28,7 @@ describe('DirectorySync', () => {
|
|
|
28
28
|
object: 'directory',
|
|
29
29
|
organizationId: 'org_01EXSR7M9QTKCC5D531SMCWMYG',
|
|
30
30
|
state: 'active',
|
|
31
|
-
type: 'okta scim
|
|
31
|
+
type: 'okta scim v2.0',
|
|
32
32
|
updatedAt: '2021-12-13 12:15:45.531847',
|
|
33
33
|
};
|
|
34
34
|
const directoryResponse = {
|
|
@@ -40,7 +40,7 @@ describe('DirectorySync', () => {
|
|
|
40
40
|
object: 'directory',
|
|
41
41
|
organization_id: 'org_01EXSR7M9QTKCC5D531SMCWMYG',
|
|
42
42
|
state: 'linked',
|
|
43
|
-
type: 'okta scim
|
|
43
|
+
type: 'okta scim v2.0',
|
|
44
44
|
updated_at: '2021-12-13 12:15:45.531847',
|
|
45
45
|
};
|
|
46
46
|
const group = {
|
|
@@ -8,16 +8,16 @@ export interface DirectoryUser<TCustomAttributes extends object = DefaultCustomA
|
|
|
8
8
|
rawAttributes: TRawAttributes;
|
|
9
9
|
customAttributes: TCustomAttributes;
|
|
10
10
|
idpId: string;
|
|
11
|
-
firstName: string;
|
|
11
|
+
firstName: string | null;
|
|
12
12
|
emails: {
|
|
13
|
-
type
|
|
14
|
-
value
|
|
15
|
-
primary
|
|
13
|
+
type?: string;
|
|
14
|
+
value?: string;
|
|
15
|
+
primary?: boolean;
|
|
16
16
|
}[];
|
|
17
|
-
username: string;
|
|
18
|
-
lastName: string;
|
|
17
|
+
username: string | null;
|
|
18
|
+
lastName: string | null;
|
|
19
19
|
jobTitle: string | null;
|
|
20
|
-
state: 'active' | 'inactive'
|
|
20
|
+
state: 'active' | 'inactive';
|
|
21
21
|
createdAt: string;
|
|
22
22
|
updatedAt: string;
|
|
23
23
|
}
|
|
@@ -29,16 +29,16 @@ export interface DirectoryUserResponse<TCustomAttributes extends object = Defaul
|
|
|
29
29
|
raw_attributes: TRawAttributes;
|
|
30
30
|
custom_attributes: TCustomAttributes;
|
|
31
31
|
idp_id: string;
|
|
32
|
-
first_name: string;
|
|
32
|
+
first_name: string | null;
|
|
33
33
|
emails: {
|
|
34
|
-
type
|
|
35
|
-
value
|
|
36
|
-
primary
|
|
34
|
+
type?: string;
|
|
35
|
+
value?: string;
|
|
36
|
+
primary?: boolean;
|
|
37
37
|
}[];
|
|
38
|
-
username: string;
|
|
39
|
-
last_name: string;
|
|
38
|
+
username: string | null;
|
|
39
|
+
last_name: string | null;
|
|
40
40
|
job_title: string | null;
|
|
41
|
-
state: 'active' | 'inactive'
|
|
41
|
+
state: 'active' | 'inactive';
|
|
42
42
|
created_at: string;
|
|
43
43
|
updated_at: string;
|
|
44
44
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type DirectoryType = 'azure scim v2.0' | 'bamboohr' | 'breathe hr' | 'cezanne hr' | 'cyberark scim v2.0' | 'fourth hr' | 'gsuite directory' | 'generic scim
|
|
1
|
+
export type DirectoryType = 'azure scim v2.0' | 'bamboohr' | 'breathe hr' | 'cezanne hr' | 'cyberark scim v2.0' | 'fourth hr' | 'gsuite directory' | 'generic scim v2.0' | 'hibob' | 'jump cloud scim v2.0' | 'okta scim v2.0' | 'onelogin scim v2.0' | 'people hr' | 'personio' | 'pingfederate scim v2.0' | 'rippling scim v2.0' | 'sftp' | 'sftp workday' | 'workday';
|
|
2
2
|
export type DirectoryState = 'active' | 'deleting' | 'inactive' | 'invalid_credentials' | 'validating';
|
|
3
3
|
export type DirectoryStateResponse = 'deleting' | 'invalid_credentials' | 'linked' | 'unlinked' | 'validating';
|
|
4
4
|
export interface Directory {
|
package/lib/index.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { WorkOS } from './workos';
|
|
2
2
|
export * from './audit-logs/interfaces';
|
|
3
|
-
export * from './audit-trail/interfaces';
|
|
4
3
|
export * from './common/exceptions';
|
|
5
4
|
export * from './common/interfaces';
|
|
6
5
|
export * from './common/utils/pagination';
|
|
@@ -11,6 +10,6 @@ export * from './organizations/interfaces';
|
|
|
11
10
|
export * from './passwordless/interfaces';
|
|
12
11
|
export * from './portal/interfaces';
|
|
13
12
|
export * from './sso/interfaces';
|
|
14
|
-
export * from './
|
|
13
|
+
export * from './user-management/interfaces';
|
|
15
14
|
export { WorkOS };
|
|
16
15
|
export default WorkOS;
|
package/lib/index.js
CHANGED
|
@@ -18,7 +18,6 @@ exports.WorkOS = void 0;
|
|
|
18
18
|
const workos_1 = require("./workos");
|
|
19
19
|
Object.defineProperty(exports, "WorkOS", { enumerable: true, get: function () { return workos_1.WorkOS; } });
|
|
20
20
|
__exportStar(require("./audit-logs/interfaces"), exports);
|
|
21
|
-
__exportStar(require("./audit-trail/interfaces"), exports);
|
|
22
21
|
__exportStar(require("./common/exceptions"), exports);
|
|
23
22
|
__exportStar(require("./common/interfaces"), exports);
|
|
24
23
|
__exportStar(require("./common/utils/pagination"), exports);
|
|
@@ -29,6 +28,6 @@ __exportStar(require("./organizations/interfaces"), exports);
|
|
|
29
28
|
__exportStar(require("./passwordless/interfaces"), exports);
|
|
30
29
|
__exportStar(require("./portal/interfaces"), exports);
|
|
31
30
|
__exportStar(require("./sso/interfaces"), exports);
|
|
32
|
-
__exportStar(require("./
|
|
31
|
+
__exportStar(require("./user-management/interfaces"), exports);
|
|
33
32
|
// tslint:disable-next-line:no-default-export
|
|
34
33
|
exports.default = workos_1.WorkOS;
|
|
@@ -4,7 +4,7 @@ export interface Challenge {
|
|
|
4
4
|
createdAt: string;
|
|
5
5
|
updatedAt: string;
|
|
6
6
|
expiresAt?: string;
|
|
7
|
-
code
|
|
7
|
+
code?: string;
|
|
8
8
|
authenticationFactorId: string;
|
|
9
9
|
}
|
|
10
10
|
export interface ChallengeResponse {
|
|
@@ -13,6 +13,6 @@ export interface ChallengeResponse {
|
|
|
13
13
|
created_at: string;
|
|
14
14
|
updated_at: string;
|
|
15
15
|
expires_at?: string;
|
|
16
|
-
code
|
|
16
|
+
code?: string;
|
|
17
17
|
authentication_factor_id: string;
|
|
18
18
|
}
|
|
@@ -1,20 +1,40 @@
|
|
|
1
1
|
import { Sms, SmsResponse } from './sms.interface';
|
|
2
|
-
import { Totp, TotpResponse } from './totp.interface';
|
|
2
|
+
import { Totp, TotpResponse, TotpWithSecrets, TotpWithSecretsResponse } from './totp.interface';
|
|
3
|
+
type FactorType = 'sms' | 'totp' | 'generic_otp';
|
|
3
4
|
export interface Factor {
|
|
4
5
|
object: 'authentication_factor';
|
|
5
6
|
id: string;
|
|
6
7
|
createdAt: string;
|
|
7
8
|
updatedAt: string;
|
|
8
|
-
type:
|
|
9
|
+
type: FactorType;
|
|
9
10
|
sms?: Sms;
|
|
10
11
|
totp?: Totp;
|
|
11
12
|
}
|
|
13
|
+
export interface FactorWithSecrets {
|
|
14
|
+
object: 'authentication_factor';
|
|
15
|
+
id: string;
|
|
16
|
+
createdAt: string;
|
|
17
|
+
updatedAt: string;
|
|
18
|
+
type: FactorType;
|
|
19
|
+
sms?: Sms;
|
|
20
|
+
totp?: TotpWithSecrets;
|
|
21
|
+
}
|
|
12
22
|
export interface FactorResponse {
|
|
13
23
|
object: 'authentication_factor';
|
|
14
24
|
id: string;
|
|
15
25
|
created_at: string;
|
|
16
26
|
updated_at: string;
|
|
17
|
-
type:
|
|
27
|
+
type: FactorType;
|
|
18
28
|
sms?: SmsResponse;
|
|
19
29
|
totp?: TotpResponse;
|
|
20
30
|
}
|
|
31
|
+
export interface FactorWithSecretsResponse {
|
|
32
|
+
object: 'authentication_factor';
|
|
33
|
+
id: string;
|
|
34
|
+
created_at: string;
|
|
35
|
+
updated_at: string;
|
|
36
|
+
type: FactorType;
|
|
37
|
+
sms?: SmsResponse;
|
|
38
|
+
totp?: TotpWithSecretsResponse;
|
|
39
|
+
}
|
|
40
|
+
export {};
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
export interface Totp {
|
|
2
2
|
issuer: string;
|
|
3
3
|
user: string;
|
|
4
|
+
}
|
|
5
|
+
export interface TotpWithSecrets extends Totp {
|
|
4
6
|
qrCode: string;
|
|
5
7
|
secret: string;
|
|
6
8
|
uri: string;
|
|
@@ -8,6 +10,8 @@ export interface Totp {
|
|
|
8
10
|
export interface TotpResponse {
|
|
9
11
|
issuer: string;
|
|
10
12
|
user: string;
|
|
13
|
+
}
|
|
14
|
+
export interface TotpWithSecretsResponse extends TotpResponse {
|
|
11
15
|
qr_code: string;
|
|
12
16
|
secret: string;
|
|
13
17
|
uri: string;
|
package/lib/mfa/mfa.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { WorkOS } from '../workos';
|
|
2
|
-
import { ChallengeFactorOptions, Challenge, EnrollFactorOptions, Factor, VerifyChallengeOptions, VerifyFactorOptions, VerifyResponse } from './interfaces';
|
|
2
|
+
import { ChallengeFactorOptions, Challenge, EnrollFactorOptions, Factor, VerifyChallengeOptions, VerifyFactorOptions, VerifyResponse, FactorWithSecrets } from './interfaces';
|
|
3
3
|
export declare class Mfa {
|
|
4
4
|
private readonly workos;
|
|
5
5
|
constructor(workos: WorkOS);
|
|
6
6
|
deleteFactor(id: string): Promise<void>;
|
|
7
7
|
getFactor(id: string): Promise<Factor>;
|
|
8
|
-
enrollFactor(options: EnrollFactorOptions): Promise<
|
|
8
|
+
enrollFactor(options: EnrollFactorOptions): Promise<FactorWithSecrets>;
|
|
9
9
|
challengeFactor(options: ChallengeFactorOptions): Promise<Challenge>;
|
|
10
10
|
/**
|
|
11
11
|
* @deprecated Please use `verifyChallenge` instead.
|
package/lib/mfa/mfa.js
CHANGED
package/lib/mfa/mfa.spec.js
CHANGED
|
@@ -28,9 +28,6 @@ describe('MFA', () => {
|
|
|
28
28
|
type: 'totp',
|
|
29
29
|
totp: {
|
|
30
30
|
issuer: 'WorkOS',
|
|
31
|
-
qrCode: 'qr-code-test',
|
|
32
|
-
secret: 'secret-test',
|
|
33
|
-
uri: 'uri-test',
|
|
34
31
|
user: 'some_user',
|
|
35
32
|
},
|
|
36
33
|
};
|
|
@@ -42,9 +39,6 @@ describe('MFA', () => {
|
|
|
42
39
|
type: 'totp',
|
|
43
40
|
totp: {
|
|
44
41
|
issuer: 'WorkOS',
|
|
45
|
-
qr_code: 'qr-code-test',
|
|
46
|
-
secret: 'secret-test',
|
|
47
|
-
uri: 'uri-test',
|
|
48
42
|
user: 'some_user',
|
|
49
43
|
},
|
|
50
44
|
};
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
import { Factor, FactorResponse } from '../interfaces';
|
|
1
|
+
import { Factor, FactorResponse, FactorWithSecrets, FactorWithSecretsResponse } from '../interfaces';
|
|
2
2
|
export declare const deserializeFactor: (factor: FactorResponse) => Factor;
|
|
3
|
+
export declare const deserializeFactorWithSecrets: (factor: FactorWithSecretsResponse) => FactorWithSecrets;
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.deserializeFactor = void 0;
|
|
3
|
+
exports.deserializeFactorWithSecrets = exports.deserializeFactor = void 0;
|
|
4
4
|
const sms_serializer_1 = require("./sms.serializer");
|
|
5
5
|
const totp_serializer_1 = require("./totp.serializer");
|
|
6
6
|
const deserializeFactor = (factor) => (Object.assign(Object.assign({ object: factor.object, id: factor.id, createdAt: factor.created_at, updatedAt: factor.updated_at, type: factor.type }, (factor.sms ? { sms: (0, sms_serializer_1.deserializeSms)(factor.sms) } : {})), (factor.totp ? { totp: (0, totp_serializer_1.deserializeTotp)(factor.totp) } : {})));
|
|
7
7
|
exports.deserializeFactor = deserializeFactor;
|
|
8
|
+
const deserializeFactorWithSecrets = (factor) => (Object.assign(Object.assign({ object: factor.object, id: factor.id, createdAt: factor.created_at, updatedAt: factor.updated_at, type: factor.type }, (factor.sms ? { sms: (0, sms_serializer_1.deserializeSms)(factor.sms) } : {})), (factor.totp ? { totp: (0, totp_serializer_1.deserializeTotpWithSecrets)(factor.totp) } : {})));
|
|
9
|
+
exports.deserializeFactorWithSecrets = deserializeFactorWithSecrets;
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
import { Totp, TotpResponse } from '../interfaces';
|
|
1
|
+
import { Totp, TotpResponse, TotpWithSecretsResponse, TotpWithSecrets } from '../interfaces';
|
|
2
2
|
export declare const deserializeTotp: (totp: TotpResponse) => Totp;
|
|
3
|
+
export declare const deserializeTotpWithSecrets: (totp: TotpWithSecretsResponse) => TotpWithSecrets;
|
|
@@ -1,11 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.deserializeTotp = void 0;
|
|
4
|
-
const deserializeTotp = (totp) =>
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
});
|
|
3
|
+
exports.deserializeTotpWithSecrets = exports.deserializeTotp = void 0;
|
|
4
|
+
const deserializeTotp = (totp) => {
|
|
5
|
+
return {
|
|
6
|
+
issuer: totp.issuer,
|
|
7
|
+
user: totp.user,
|
|
8
|
+
};
|
|
9
|
+
};
|
|
11
10
|
exports.deserializeTotp = deserializeTotp;
|
|
11
|
+
const deserializeTotpWithSecrets = (totp) => {
|
|
12
|
+
return {
|
|
13
|
+
issuer: totp.issuer,
|
|
14
|
+
user: totp.user,
|
|
15
|
+
qrCode: totp.qr_code,
|
|
16
|
+
secret: totp.secret,
|
|
17
|
+
uri: totp.uri,
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
exports.deserializeTotpWithSecrets = deserializeTotpWithSecrets;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export interface AuthorizationURLOptions {
|
|
2
|
-
|
|
2
|
+
clientId: string;
|
|
3
3
|
connection?: string;
|
|
4
4
|
organization?: string;
|
|
5
5
|
/**
|
|
@@ -9,6 +9,6 @@ export interface AuthorizationURLOptions {
|
|
|
9
9
|
domainHint?: string;
|
|
10
10
|
loginHint?: string;
|
|
11
11
|
provider?: string;
|
|
12
|
-
|
|
12
|
+
redirectUri: string;
|
|
13
13
|
state?: string;
|
|
14
14
|
}
|
package/lib/sso/sso.d.ts
CHANGED
|
@@ -6,8 +6,8 @@ export declare class SSO {
|
|
|
6
6
|
constructor(workos: WorkOS);
|
|
7
7
|
listConnections(options?: ListConnectionsOptions): Promise<AutoPaginatable<Connection>>;
|
|
8
8
|
deleteConnection(id: string): Promise<void>;
|
|
9
|
-
|
|
9
|
+
getAuthorizationUrl({ connection, clientId, domain, domainHint, loginHint, organization, provider, redirectUri, state, }: AuthorizationURLOptions): string;
|
|
10
10
|
getConnection(id: string): Promise<Connection>;
|
|
11
|
-
getProfileAndToken({ code,
|
|
11
|
+
getProfileAndToken({ code, clientId, }: GetProfileAndTokenOptions): Promise<ProfileAndToken>;
|
|
12
12
|
getProfile({ accessToken }: GetProfileOptions): Promise<Profile>;
|
|
13
13
|
}
|
package/lib/sso/sso.js
CHANGED
|
@@ -38,7 +38,7 @@ class SSO {
|
|
|
38
38
|
yield this.workos.delete(`/connections/${id}`);
|
|
39
39
|
});
|
|
40
40
|
}
|
|
41
|
-
|
|
41
|
+
getAuthorizationUrl({ connection, clientId, domain, domainHint, loginHint, organization, provider, redirectUri, state, }) {
|
|
42
42
|
if (!domain && !provider && !connection && !organization) {
|
|
43
43
|
throw new Error(`Incomplete arguments. Need to specify either a 'connection', 'organization', 'domain', or 'provider'.`);
|
|
44
44
|
}
|
|
@@ -52,8 +52,8 @@ class SSO {
|
|
|
52
52
|
domain_hint: domainHint,
|
|
53
53
|
login_hint: loginHint,
|
|
54
54
|
provider,
|
|
55
|
-
client_id:
|
|
56
|
-
redirect_uri:
|
|
55
|
+
client_id: clientId,
|
|
56
|
+
redirect_uri: redirectUri,
|
|
57
57
|
response_type: 'code',
|
|
58
58
|
state,
|
|
59
59
|
});
|
|
@@ -65,10 +65,10 @@ class SSO {
|
|
|
65
65
|
return (0, serializers_1.deserializeConnection)(data);
|
|
66
66
|
});
|
|
67
67
|
}
|
|
68
|
-
getProfileAndToken({ code,
|
|
68
|
+
getProfileAndToken({ code, clientId, }) {
|
|
69
69
|
return __awaiter(this, void 0, void 0, function* () {
|
|
70
70
|
const form = new URLSearchParams({
|
|
71
|
-
client_id:
|
|
71
|
+
client_id: clientId,
|
|
72
72
|
client_secret: this.workos.key,
|
|
73
73
|
grant_type: 'authorization_code',
|
|
74
74
|
code,
|
package/lib/sso/sso.spec.js
CHANGED
|
@@ -29,14 +29,14 @@ describe('SSO', () => {
|
|
|
29
29
|
updated_at: '2023-07-17T20:07:20.055Z',
|
|
30
30
|
};
|
|
31
31
|
describe('SSO', () => {
|
|
32
|
-
describe('
|
|
32
|
+
describe('getAuthorizationUrl', () => {
|
|
33
33
|
describe('with no custom api hostname', () => {
|
|
34
34
|
it('generates an authorize url with the default api hostname', () => {
|
|
35
35
|
const workos = new workos_1.WorkOS('sk_test_Sz3IQjepeSWaI4cMS4ms4sMuU');
|
|
36
|
-
const url = workos.sso.
|
|
36
|
+
const url = workos.sso.getAuthorizationUrl({
|
|
37
37
|
domain: 'lyft.com',
|
|
38
|
-
|
|
39
|
-
|
|
38
|
+
clientId: 'proj_123',
|
|
39
|
+
redirectUri: 'example.com/sso/workos/callback',
|
|
40
40
|
});
|
|
41
41
|
expect(url).toMatchSnapshot();
|
|
42
42
|
});
|
|
@@ -44,9 +44,9 @@ describe('SSO', () => {
|
|
|
44
44
|
describe('with no domain or provider', () => {
|
|
45
45
|
it('throws an error for incomplete arguments', () => {
|
|
46
46
|
const workos = new workos_1.WorkOS('sk_test_Sz3IQjepeSWaI4cMS4ms4sMuU');
|
|
47
|
-
const urlFn = () => workos.sso.
|
|
48
|
-
|
|
49
|
-
|
|
47
|
+
const urlFn = () => workos.sso.getAuthorizationUrl({
|
|
48
|
+
clientId: 'proj_123',
|
|
49
|
+
redirectUri: 'example.com/sso/workos/callback',
|
|
50
50
|
});
|
|
51
51
|
expect(urlFn).toThrowErrorMatchingSnapshot();
|
|
52
52
|
});
|
|
@@ -56,10 +56,10 @@ describe('SSO', () => {
|
|
|
56
56
|
const workos = new workos_1.WorkOS('sk_test_Sz3IQjepeSWaI4cMS4ms4sMuU', {
|
|
57
57
|
apiHostname: 'api.workos.dev',
|
|
58
58
|
});
|
|
59
|
-
const url = workos.sso.
|
|
59
|
+
const url = workos.sso.getAuthorizationUrl({
|
|
60
60
|
provider: 'Google',
|
|
61
|
-
|
|
62
|
-
|
|
61
|
+
clientId: 'proj_123',
|
|
62
|
+
redirectUri: 'example.com/sso/workos/callback',
|
|
63
63
|
});
|
|
64
64
|
expect(url).toMatchSnapshot();
|
|
65
65
|
});
|
|
@@ -69,10 +69,10 @@ describe('SSO', () => {
|
|
|
69
69
|
const workos = new workos_1.WorkOS('sk_test_Sz3IQjepeSWaI4cMS4ms4sMuU', {
|
|
70
70
|
apiHostname: 'api.workos.dev',
|
|
71
71
|
});
|
|
72
|
-
const url = workos.sso.
|
|
72
|
+
const url = workos.sso.getAuthorizationUrl({
|
|
73
73
|
connection: 'connection_123',
|
|
74
|
-
|
|
75
|
-
|
|
74
|
+
clientId: 'proj_123',
|
|
75
|
+
redirectUri: 'example.com/sso/workos/callback',
|
|
76
76
|
});
|
|
77
77
|
expect(url).toMatchSnapshot();
|
|
78
78
|
});
|
|
@@ -82,10 +82,10 @@ describe('SSO', () => {
|
|
|
82
82
|
const workos = new workos_1.WorkOS('sk_test_Sz3IQjepeSWaI4cMS4ms4sMuU', {
|
|
83
83
|
apiHostname: 'api.workos.dev',
|
|
84
84
|
});
|
|
85
|
-
const url = workos.sso.
|
|
85
|
+
const url = workos.sso.getAuthorizationUrl({
|
|
86
86
|
organization: 'organization_123',
|
|
87
|
-
|
|
88
|
-
|
|
87
|
+
clientId: 'proj_123',
|
|
88
|
+
redirectUri: 'example.com/sso/workos/callback',
|
|
89
89
|
});
|
|
90
90
|
expect(url).toMatchSnapshot();
|
|
91
91
|
});
|
|
@@ -95,10 +95,10 @@ describe('SSO', () => {
|
|
|
95
95
|
const workos = new workos_1.WorkOS('sk_test_Sz3IQjepeSWaI4cMS4ms4sMuU', {
|
|
96
96
|
apiHostname: 'api.workos.dev',
|
|
97
97
|
});
|
|
98
|
-
const url = workos.sso.
|
|
98
|
+
const url = workos.sso.getAuthorizationUrl({
|
|
99
99
|
domain: 'lyft.com',
|
|
100
|
-
|
|
101
|
-
|
|
100
|
+
clientId: 'proj_123',
|
|
101
|
+
redirectUri: 'example.com/sso/workos/callback',
|
|
102
102
|
});
|
|
103
103
|
expect(url).toMatchSnapshot();
|
|
104
104
|
});
|
|
@@ -106,10 +106,10 @@ describe('SSO', () => {
|
|
|
106
106
|
describe('with state', () => {
|
|
107
107
|
it('generates an authorize url with the provided state', () => {
|
|
108
108
|
const workos = new workos_1.WorkOS('sk_test_Sz3IQjepeSWaI4cMS4ms4sMuU');
|
|
109
|
-
const url = workos.sso.
|
|
109
|
+
const url = workos.sso.getAuthorizationUrl({
|
|
110
110
|
domain: 'lyft.com',
|
|
111
|
-
|
|
112
|
-
|
|
111
|
+
clientId: 'proj_123',
|
|
112
|
+
redirectUri: 'example.com/sso/workos/callback',
|
|
113
113
|
state: 'custom state',
|
|
114
114
|
});
|
|
115
115
|
expect(url).toMatchSnapshot();
|
|
@@ -118,11 +118,11 @@ describe('SSO', () => {
|
|
|
118
118
|
describe('with domainHint', () => {
|
|
119
119
|
it('generates an authorize url with the provided domain hint', () => {
|
|
120
120
|
const workos = new workos_1.WorkOS('sk_test_Sz3IQjepeSWaI4cMS4ms4sMuU');
|
|
121
|
-
const url = workos.sso.
|
|
121
|
+
const url = workos.sso.getAuthorizationUrl({
|
|
122
122
|
domainHint: 'lyft.com',
|
|
123
123
|
connection: 'connection_123',
|
|
124
|
-
|
|
125
|
-
|
|
124
|
+
clientId: 'proj_123',
|
|
125
|
+
redirectUri: 'example.com/sso/workos/callback',
|
|
126
126
|
state: 'custom state',
|
|
127
127
|
});
|
|
128
128
|
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+state"`);
|
|
@@ -131,11 +131,11 @@ describe('SSO', () => {
|
|
|
131
131
|
describe('with loginHint', () => {
|
|
132
132
|
it('generates an authorize url with the provided login hint', () => {
|
|
133
133
|
const workos = new workos_1.WorkOS('sk_test_Sz3IQjepeSWaI4cMS4ms4sMuU');
|
|
134
|
-
const url = workos.sso.
|
|
134
|
+
const url = workos.sso.getAuthorizationUrl({
|
|
135
135
|
loginHint: 'foo@workos.com',
|
|
136
136
|
connection: 'connection_123',
|
|
137
|
-
|
|
138
|
-
|
|
137
|
+
clientId: 'proj_123',
|
|
138
|
+
redirectUri: 'example.com/sso/workos/callback',
|
|
139
139
|
state: 'custom state',
|
|
140
140
|
});
|
|
141
141
|
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+state"`);
|
|
@@ -186,7 +186,7 @@ describe('SSO', () => {
|
|
|
186
186
|
const workos = new workos_1.WorkOS('sk_test_Sz3IQjepeSWaI4cMS4ms4sMuU');
|
|
187
187
|
const { accessToken, profile } = yield workos.sso.getProfileAndToken({
|
|
188
188
|
code: 'authorization_code',
|
|
189
|
-
|
|
189
|
+
clientId: 'proj_123',
|
|
190
190
|
});
|
|
191
191
|
expect(mock.history.post.length).toBe(1);
|
|
192
192
|
const { data, headers } = mock.history.post[0];
|
|
@@ -237,7 +237,7 @@ describe('SSO', () => {
|
|
|
237
237
|
const workos = new workos_1.WorkOS('sk_test_Sz3IQjepeSWaI4cMS4ms4sMuU');
|
|
238
238
|
const { accessToken, profile } = yield workos.sso.getProfileAndToken({
|
|
239
239
|
code: 'authorization_code',
|
|
240
|
-
|
|
240
|
+
clientId: 'proj_123',
|
|
241
241
|
});
|
|
242
242
|
expect(mock.history.post.length).toBe(1);
|
|
243
243
|
const { data, headers } = mock.history.post[0];
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
{
|
|
2
|
+
"object": "invitation",
|
|
3
|
+
"id": "invitation_01H5JQDV7R7ATEYZDEG0W5PRYS",
|
|
4
|
+
"email": "dane@workos.com",
|
|
5
|
+
"state": "pending",
|
|
6
|
+
"accepted_at": "2023-07-18T02:07:19.911Z",
|
|
7
|
+
"revoked_at": "2023-07-18T02:07:19.911Z",
|
|
8
|
+
"expires_at": "2023-07-18T02:07:19.911Z",
|
|
9
|
+
"organization_id": "org_01H5JQDV7R7ATEYZDEG0W5PRYS",
|
|
10
|
+
"token": "Z1uX3RbwcIl5fIGJJJCXXisdI",
|
|
11
|
+
"created_at": "2023-07-18T02:07:19.911Z",
|
|
12
|
+
"updated_at": "2023-07-18T02:07:19.911Z"
|
|
13
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"object": "list",
|
|
3
|
+
"data": [
|
|
4
|
+
{
|
|
5
|
+
"object": "invitation",
|
|
6
|
+
"id": "invitation_01H5JQDV7R7ATEYZDEG0W5PRYS",
|
|
7
|
+
"email": "dane@workos.com",
|
|
8
|
+
"state": "pending",
|
|
9
|
+
"accepted_at": "2023-07-18T02:07:19.911Z",
|
|
10
|
+
"revoked_at": "2023-07-18T02:07:19.911Z",
|
|
11
|
+
"expires_at": "2023-07-18T02:07:19.911Z",
|
|
12
|
+
"organization_id": "org_01H5JQDV7R7ATEYZDEG0W5PRYS",
|
|
13
|
+
"token": "Z1uX3RbwcIl5fIGJJJCXXisdI",
|
|
14
|
+
"created_at": "2023-07-18T02:07:19.911Z",
|
|
15
|
+
"updated_at": "2023-07-18T02:07:19.911Z"
|
|
16
|
+
}
|
|
17
|
+
],
|
|
18
|
+
"list_metadata": {
|
|
19
|
+
"before": null,
|
|
20
|
+
"after": null
|
|
21
|
+
}
|
|
22
|
+
}
|