@workos-inc/node 7.55.0 → 7.57.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 +10 -2
- package/lib/common/serializers/event.serializer.js +1 -0
- package/lib/user-management/interfaces/authenticate-with-code-and-verifier-options.interface.d.ts +12 -0
- package/lib/user-management/interfaces/authenticate-with-code-and-verifier-options.interface.js +2 -0
- package/lib/user-management/interfaces/authenticate-with-options-base.interface.d.ts +5 -0
- package/lib/user-management/interfaces/index.d.ts +1 -0
- package/lib/user-management/interfaces/index.js +1 -0
- package/lib/user-management/serializers/authenticate-with-code-and-verifier-options.serializer.d.ts +2 -0
- package/lib/user-management/serializers/authenticate-with-code-and-verifier-options.serializer.js +13 -0
- package/lib/user-management/serializers/index.d.ts +1 -0
- package/lib/user-management/serializers/index.js +1 -0
- package/lib/user-management/user-management.d.ts +2 -1
- package/lib/user-management/user-management.js +10 -0
- package/lib/user-management/user-management.spec.js +84 -0
- package/lib/workos.js +1 -1
- package/package.json +1 -1
|
@@ -402,6 +402,14 @@ export interface SessionCreatedEventResponse extends EventResponseBase {
|
|
|
402
402
|
event: 'session.created';
|
|
403
403
|
data: SessionResponse;
|
|
404
404
|
}
|
|
405
|
+
export interface SessionRevokedEvent extends EventBase {
|
|
406
|
+
event: 'session.revoked';
|
|
407
|
+
data: Session;
|
|
408
|
+
}
|
|
409
|
+
export interface SessionRevokedEventResponse extends EventResponseBase {
|
|
410
|
+
event: 'session.revoked';
|
|
411
|
+
data: SessionResponse;
|
|
412
|
+
}
|
|
405
413
|
export interface OrganizationDomainVerifiedEvent extends EventBase {
|
|
406
414
|
event: 'organization_domain.verified';
|
|
407
415
|
data: OrganizationDomain;
|
|
@@ -418,7 +426,7 @@ export interface OrganizationDomainVerificationFailedEventResponse extends Event
|
|
|
418
426
|
event: 'organization_domain.verification_failed';
|
|
419
427
|
data: OrganizationDomainResponse;
|
|
420
428
|
}
|
|
421
|
-
export type Event = AuthenticationEmailVerificationSucceededEvent | AuthenticationMfaSucceededEvent | AuthenticationOAuthFailedEvent | AuthenticationOAuthSucceededEvent | AuthenticationSSOFailedEvent | AuthenticationSSOSucceededEvent | AuthenticationPasswordFailedEvent | AuthenticationPasswordSucceededEvent | AuthenticationMagicAuthFailedEvent | AuthenticationMagicAuthSucceededEvent | AuthenticationRadarRiskDetectedEvent | ConnectionActivatedEvent | ConnectionDeactivatedEvent | ConnectionDeletedEvent | DsyncActivatedEvent | DsyncDeactivatedEvent | DsyncDeletedEvent | DsyncGroupCreatedEvent | DsyncGroupUpdatedEvent | DsyncGroupDeletedEvent | DsyncGroupUserAddedEvent | DsyncGroupUserRemovedEvent | DsyncUserCreatedEvent | DsyncUserUpdatedEvent | DsyncUserDeletedEvent | EmailVerificationCreatedEvent | InvitationCreatedEvent | MagicAuthCreatedEvent | PasswordResetCreatedEvent | PasswordResetSucceededEvent | UserCreatedEvent | UserUpdatedEvent | UserDeletedEvent | OrganizationMembershipAdded | OrganizationMembershipCreated | OrganizationMembershipDeleted | OrganizationMembershipUpdated | OrganizationMembershipRemoved | RoleCreatedEvent | RoleDeletedEvent | RoleUpdatedEvent | SessionCreatedEvent | OrganizationCreatedEvent | OrganizationUpdatedEvent | OrganizationDeletedEvent | OrganizationDomainVerifiedEvent | OrganizationDomainVerificationFailedEvent;
|
|
422
|
-
export type EventResponse = AuthenticationEmailVerificationSucceededEventResponse | AuthenticationMagicAuthFailedEventResponse | AuthenticationMagicAuthSucceededEventResponse | AuthenticationMfaSucceededEventResponse | AuthenticationOAuthFailedEventResponse | AuthenticationOAuthSucceededEventResponse | AuthenticationPasswordFailedEventResponse | AuthenticationPasswordSucceededEventResponse | AuthenticationSSOFailedEventResponse | AuthenticationSSOSucceededEventResponse | AuthenticationRadarRiskDetectedEventResponse | ConnectionActivatedEventResponse | ConnectionDeactivatedEventResponse | ConnectionDeletedEventResponse | DsyncActivatedEventResponse | DsyncDeactivatedEventResponse | DsyncDeletedEventResponse | DsyncGroupCreatedEventResponse | DsyncGroupUpdatedEventResponse | DsyncGroupDeletedEventResponse | DsyncGroupUserAddedEventResponse | DsyncGroupUserRemovedEventResponse | DsyncUserCreatedEventResponse | DsyncUserUpdatedEventResponse | DsyncUserDeletedEventResponse | EmailVerificationCreatedEventResponse | InvitationCreatedEventResponse | MagicAuthCreatedEventResponse | PasswordResetCreatedEventResponse | PasswordResetSucceededEventResponse | UserCreatedEventResponse | UserUpdatedEventResponse | UserDeletedEventResponse | OrganizationMembershipAddedResponse | OrganizationMembershipCreatedResponse | OrganizationMembershipDeletedResponse | OrganizationMembershipUpdatedResponse | OrganizationMembershipRemovedResponse | RoleCreatedEventResponse | RoleDeletedEventResponse | RoleUpdatedEventResponse | SessionCreatedEventResponse | OrganizationCreatedResponse | OrganizationUpdatedResponse | OrganizationDeletedResponse | OrganizationDomainVerifiedEventResponse | OrganizationDomainVerificationFailedEventResponse;
|
|
429
|
+
export type Event = AuthenticationEmailVerificationSucceededEvent | AuthenticationMfaSucceededEvent | AuthenticationOAuthFailedEvent | AuthenticationOAuthSucceededEvent | AuthenticationSSOFailedEvent | AuthenticationSSOSucceededEvent | AuthenticationPasswordFailedEvent | AuthenticationPasswordSucceededEvent | AuthenticationMagicAuthFailedEvent | AuthenticationMagicAuthSucceededEvent | AuthenticationRadarRiskDetectedEvent | ConnectionActivatedEvent | ConnectionDeactivatedEvent | ConnectionDeletedEvent | DsyncActivatedEvent | DsyncDeactivatedEvent | DsyncDeletedEvent | DsyncGroupCreatedEvent | DsyncGroupUpdatedEvent | DsyncGroupDeletedEvent | DsyncGroupUserAddedEvent | DsyncGroupUserRemovedEvent | DsyncUserCreatedEvent | DsyncUserUpdatedEvent | DsyncUserDeletedEvent | EmailVerificationCreatedEvent | InvitationCreatedEvent | MagicAuthCreatedEvent | PasswordResetCreatedEvent | PasswordResetSucceededEvent | UserCreatedEvent | UserUpdatedEvent | UserDeletedEvent | OrganizationMembershipAdded | OrganizationMembershipCreated | OrganizationMembershipDeleted | OrganizationMembershipUpdated | OrganizationMembershipRemoved | RoleCreatedEvent | RoleDeletedEvent | RoleUpdatedEvent | SessionCreatedEvent | SessionRevokedEvent | OrganizationCreatedEvent | OrganizationUpdatedEvent | OrganizationDeletedEvent | OrganizationDomainVerifiedEvent | OrganizationDomainVerificationFailedEvent;
|
|
430
|
+
export type EventResponse = AuthenticationEmailVerificationSucceededEventResponse | AuthenticationMagicAuthFailedEventResponse | AuthenticationMagicAuthSucceededEventResponse | AuthenticationMfaSucceededEventResponse | AuthenticationOAuthFailedEventResponse | AuthenticationOAuthSucceededEventResponse | AuthenticationPasswordFailedEventResponse | AuthenticationPasswordSucceededEventResponse | AuthenticationSSOFailedEventResponse | AuthenticationSSOSucceededEventResponse | AuthenticationRadarRiskDetectedEventResponse | ConnectionActivatedEventResponse | ConnectionDeactivatedEventResponse | ConnectionDeletedEventResponse | DsyncActivatedEventResponse | DsyncDeactivatedEventResponse | DsyncDeletedEventResponse | DsyncGroupCreatedEventResponse | DsyncGroupUpdatedEventResponse | DsyncGroupDeletedEventResponse | DsyncGroupUserAddedEventResponse | DsyncGroupUserRemovedEventResponse | DsyncUserCreatedEventResponse | DsyncUserUpdatedEventResponse | DsyncUserDeletedEventResponse | EmailVerificationCreatedEventResponse | InvitationCreatedEventResponse | MagicAuthCreatedEventResponse | PasswordResetCreatedEventResponse | PasswordResetSucceededEventResponse | UserCreatedEventResponse | UserUpdatedEventResponse | UserDeletedEventResponse | OrganizationMembershipAddedResponse | OrganizationMembershipCreatedResponse | OrganizationMembershipDeletedResponse | OrganizationMembershipUpdatedResponse | OrganizationMembershipRemovedResponse | RoleCreatedEventResponse | RoleDeletedEventResponse | RoleUpdatedEventResponse | SessionCreatedEventResponse | SessionRevokedEventResponse | OrganizationCreatedResponse | OrganizationUpdatedResponse | OrganizationDeletedResponse | OrganizationDomainVerifiedEventResponse | OrganizationDomainVerificationFailedEventResponse;
|
|
423
431
|
export type EventName = Event['event'];
|
|
424
432
|
export {};
|
|
@@ -79,6 +79,7 @@ const deserializeEvent = (event) => {
|
|
|
79
79
|
case 'role.updated':
|
|
80
80
|
return Object.assign(Object.assign({}, eventBase), { event: event.event, data: (0, role_serializer_1.deserializeRoleEvent)(event.data) });
|
|
81
81
|
case 'session.created':
|
|
82
|
+
case 'session.revoked':
|
|
82
83
|
return Object.assign(Object.assign({}, eventBase), { event: event.event, data: (0, session_serializer_1.deserializeSession)(event.data) });
|
|
83
84
|
case 'organization.created':
|
|
84
85
|
case 'organization.updated':
|
package/lib/user-management/interfaces/authenticate-with-code-and-verifier-options.interface.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { AuthenticateWithOptionsBase, SerializedAuthenticateWithPKCEBase } from './authenticate-with-options-base.interface';
|
|
2
|
+
export interface AuthenticateWithCodeAndVerifierOptions extends AuthenticateWithOptionsBase {
|
|
3
|
+
codeVerifier: string;
|
|
4
|
+
code: string;
|
|
5
|
+
invitationToken?: string;
|
|
6
|
+
}
|
|
7
|
+
export interface SerializedAuthenticateWithCodeAndVerifierOptions extends SerializedAuthenticateWithPKCEBase {
|
|
8
|
+
grant_type: 'authorization_code';
|
|
9
|
+
code_verifier: string;
|
|
10
|
+
code: string;
|
|
11
|
+
invitation_token?: string;
|
|
12
|
+
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export * from './authenticate-with-code-options.interface';
|
|
2
|
+
export * from './authenticate-with-code-and-verifier-options.interface';
|
|
2
3
|
export * from './authenticate-with-email-verification-options.interface';
|
|
3
4
|
export * from './authenticate-with-magic-auth-options.interface';
|
|
4
5
|
export * from './authenticate-with-options-base.interface';
|
|
@@ -15,6 +15,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./authenticate-with-code-options.interface"), exports);
|
|
18
|
+
__exportStar(require("./authenticate-with-code-and-verifier-options.interface"), exports);
|
|
18
19
|
__exportStar(require("./authenticate-with-email-verification-options.interface"), exports);
|
|
19
20
|
__exportStar(require("./authenticate-with-magic-auth-options.interface"), exports);
|
|
20
21
|
__exportStar(require("./authenticate-with-options-base.interface"), exports);
|
package/lib/user-management/serializers/authenticate-with-code-and-verifier-options.serializer.d.ts
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { AuthenticateWithCodeAndVerifierOptions, SerializedAuthenticateWithCodeAndVerifierOptions } from '../interfaces';
|
|
2
|
+
export declare const serializeAuthenticateWithCodeAndVerifierOptions: (options: AuthenticateWithCodeAndVerifierOptions) => SerializedAuthenticateWithCodeAndVerifierOptions;
|
package/lib/user-management/serializers/authenticate-with-code-and-verifier-options.serializer.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.serializeAuthenticateWithCodeAndVerifierOptions = void 0;
|
|
4
|
+
const serializeAuthenticateWithCodeAndVerifierOptions = (options) => ({
|
|
5
|
+
grant_type: 'authorization_code',
|
|
6
|
+
client_id: options.clientId,
|
|
7
|
+
code: options.code,
|
|
8
|
+
code_verifier: options.codeVerifier,
|
|
9
|
+
invitation_token: options.invitationToken,
|
|
10
|
+
ip_address: options.ipAddress,
|
|
11
|
+
user_agent: options.userAgent,
|
|
12
|
+
});
|
|
13
|
+
exports.serializeAuthenticateWithCodeAndVerifierOptions = serializeAuthenticateWithCodeAndVerifierOptions;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export * from './authenticate-with-code-options.serializer';
|
|
2
|
+
export * from './authenticate-with-code-and-verifier-options.serializer';
|
|
2
3
|
export * from './authenticate-with-magic-auth-options.serializer';
|
|
3
4
|
export * from './authenticate-with-password-options.serializer';
|
|
4
5
|
export * from './authenticate-with-refresh-token.options.serializer';
|
|
@@ -15,6 +15,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./authenticate-with-code-options.serializer"), exports);
|
|
18
|
+
__exportStar(require("./authenticate-with-code-and-verifier-options.serializer"), exports);
|
|
18
19
|
__exportStar(require("./authenticate-with-magic-auth-options.serializer"), exports);
|
|
19
20
|
__exportStar(require("./authenticate-with-password-options.serializer"), exports);
|
|
20
21
|
__exportStar(require("./authenticate-with-refresh-token.options.serializer"), exports);
|
|
@@ -3,7 +3,7 @@ import { IronSessionProvider } from '../common/iron-session/iron-session-provide
|
|
|
3
3
|
import { AutoPaginatable } from '../common/utils/pagination';
|
|
4
4
|
import { Challenge } from '../mfa/interfaces';
|
|
5
5
|
import { WorkOS } from '../workos';
|
|
6
|
-
import { AuthenticateWithCodeOptions, AuthenticateWithMagicAuthOptions, AuthenticateWithPasswordOptions, AuthenticateWithRefreshTokenOptions, AuthenticateWithTotpOptions, AuthenticationResponse, CreateMagicAuthOptions, CreatePasswordResetOptions, CreateUserOptions, EmailVerification, EnrollAuthFactorOptions, ListAuthFactorsOptions, ListUsersOptions, MagicAuth, PasswordReset, ResetPasswordOptions, SendMagicAuthCodeOptions, SendPasswordResetEmailOptions, SendVerificationEmailOptions, UpdateUserOptions, User, VerifyEmailOptions } from './interfaces';
|
|
6
|
+
import { AuthenticateWithCodeOptions, AuthenticateWithCodeAndVerifierOptions, AuthenticateWithMagicAuthOptions, AuthenticateWithPasswordOptions, AuthenticateWithRefreshTokenOptions, AuthenticateWithTotpOptions, AuthenticationResponse, CreateMagicAuthOptions, CreatePasswordResetOptions, CreateUserOptions, EmailVerification, EnrollAuthFactorOptions, ListAuthFactorsOptions, ListUsersOptions, MagicAuth, PasswordReset, ResetPasswordOptions, SendMagicAuthCodeOptions, SendPasswordResetEmailOptions, SendVerificationEmailOptions, UpdateUserOptions, User, VerifyEmailOptions } from './interfaces';
|
|
7
7
|
import { AuthenticateWithEmailVerificationOptions } from './interfaces/authenticate-with-email-verification-options.interface';
|
|
8
8
|
import { AuthenticateWithOrganizationSelectionOptions } from './interfaces/authenticate-with-organization-selection.interface';
|
|
9
9
|
import { AuthenticateWithSessionCookieFailedResponse, AuthenticateWithSessionCookieOptions, AuthenticateWithSessionCookieSuccessResponse, SessionCookieData } from './interfaces/authenticate-with-session-cookie.interface';
|
|
@@ -47,6 +47,7 @@ export declare class UserManagement {
|
|
|
47
47
|
authenticateWithMagicAuth(payload: AuthenticateWithMagicAuthOptions): Promise<AuthenticationResponse>;
|
|
48
48
|
authenticateWithPassword(payload: AuthenticateWithPasswordOptions): Promise<AuthenticationResponse>;
|
|
49
49
|
authenticateWithCode(payload: AuthenticateWithCodeOptions): Promise<AuthenticationResponse>;
|
|
50
|
+
authenticateWithCodeAndVerifier(payload: AuthenticateWithCodeAndVerifierOptions): Promise<AuthenticationResponse>;
|
|
50
51
|
authenticateWithRefreshToken(payload: AuthenticateWithRefreshTokenOptions): Promise<AuthenticationResponse>;
|
|
51
52
|
authenticateWithTotp(payload: AuthenticateWithTotpOptions): Promise<AuthenticationResponse>;
|
|
52
53
|
authenticateWithEmailVerification(payload: AuthenticateWithEmailVerificationOptions): Promise<AuthenticationResponse>;
|
|
@@ -141,6 +141,16 @@ class UserManagement {
|
|
|
141
141
|
});
|
|
142
142
|
});
|
|
143
143
|
}
|
|
144
|
+
authenticateWithCodeAndVerifier(payload) {
|
|
145
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
146
|
+
const { session } = payload, remainingPayload = __rest(payload, ["session"]);
|
|
147
|
+
const { data } = yield this.workos.post('/user_management/authenticate', (0, serializers_2.serializeAuthenticateWithCodeAndVerifierOptions)(remainingPayload));
|
|
148
|
+
return this.prepareAuthenticationResponse({
|
|
149
|
+
authenticationResponse: (0, serializers_2.deserializeAuthenticationResponse)(data),
|
|
150
|
+
session,
|
|
151
|
+
});
|
|
152
|
+
});
|
|
153
|
+
}
|
|
144
154
|
authenticateWithRefreshToken(payload) {
|
|
145
155
|
return __awaiter(this, void 0, void 0, function* () {
|
|
146
156
|
const { session } = payload, remainingPayload = __rest(payload, ["session"]);
|
|
@@ -433,6 +433,90 @@ describe('UserManagement', () => {
|
|
|
433
433
|
}));
|
|
434
434
|
});
|
|
435
435
|
});
|
|
436
|
+
describe('authenticateWithCodeAndVerifier', () => {
|
|
437
|
+
it('sends a token authentication request with required code_verifier', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
438
|
+
(0, test_utils_1.fetchOnce)({ user: user_json_1.default });
|
|
439
|
+
const resp = yield workos.userManagement.authenticateWithCodeAndVerifier({
|
|
440
|
+
clientId: 'proj_whatever',
|
|
441
|
+
code: 'auth_code_123',
|
|
442
|
+
codeVerifier: 'required_code_verifier',
|
|
443
|
+
});
|
|
444
|
+
expect((0, test_utils_1.fetchURL)()).toContain('/user_management/authenticate');
|
|
445
|
+
expect((0, test_utils_1.fetchBody)()).toEqual({
|
|
446
|
+
client_id: 'proj_whatever',
|
|
447
|
+
code: 'auth_code_123',
|
|
448
|
+
code_verifier: 'required_code_verifier',
|
|
449
|
+
grant_type: 'authorization_code',
|
|
450
|
+
});
|
|
451
|
+
expect(resp).toMatchObject({
|
|
452
|
+
user: {
|
|
453
|
+
email: 'test01@example.com',
|
|
454
|
+
},
|
|
455
|
+
});
|
|
456
|
+
}));
|
|
457
|
+
it('sends a token authentication request with invitation token', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
458
|
+
(0, test_utils_1.fetchOnce)({ user: user_json_1.default });
|
|
459
|
+
const resp = yield workos.userManagement.authenticateWithCodeAndVerifier({
|
|
460
|
+
clientId: 'proj_whatever',
|
|
461
|
+
code: 'auth_code_123',
|
|
462
|
+
codeVerifier: 'required_code_verifier',
|
|
463
|
+
invitationToken: 'invitation_123',
|
|
464
|
+
});
|
|
465
|
+
expect((0, test_utils_1.fetchURL)()).toContain('/user_management/authenticate');
|
|
466
|
+
expect((0, test_utils_1.fetchBody)()).toEqual({
|
|
467
|
+
client_id: 'proj_whatever',
|
|
468
|
+
code: 'auth_code_123',
|
|
469
|
+
code_verifier: 'required_code_verifier',
|
|
470
|
+
invitation_token: 'invitation_123',
|
|
471
|
+
grant_type: 'authorization_code',
|
|
472
|
+
});
|
|
473
|
+
expect(resp).toMatchObject({
|
|
474
|
+
user: {
|
|
475
|
+
email: 'test01@example.com',
|
|
476
|
+
},
|
|
477
|
+
});
|
|
478
|
+
}));
|
|
479
|
+
describe('when sealSession = true', () => {
|
|
480
|
+
beforeEach(() => {
|
|
481
|
+
(0, test_utils_1.fetchOnce)({
|
|
482
|
+
user: user_json_1.default,
|
|
483
|
+
access_token: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.ewogICJzdWIiOiAiMTIzNDU2Nzg5MCIsCiAgIm5hbWUiOiAiSm9obiBEb2UiLAogICJpYXQiOiAxNTE2MjM5MDIyLAogICJzaWQiOiAic2Vzc2lvbl8xMjMiLAogICJvcmdfaWQiOiAib3JnXzEyMyIsCiAgInJvbGUiOiAibWVtYmVyIiwKICAicGVybWlzc2lvbnMiOiBbInBvc3RzOmNyZWF0ZSIsICJwb3N0czpkZWxldGUiXQp9.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c',
|
|
484
|
+
});
|
|
485
|
+
});
|
|
486
|
+
describe('when the cookie password is undefined', () => {
|
|
487
|
+
it('throws an error', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
488
|
+
yield expect(workos.userManagement.authenticateWithCodeAndVerifier({
|
|
489
|
+
clientId: 'proj_whatever',
|
|
490
|
+
code: 'auth_code_123',
|
|
491
|
+
codeVerifier: 'required_code_verifier',
|
|
492
|
+
session: { sealSession: true },
|
|
493
|
+
})).rejects.toThrow('Cookie password is required');
|
|
494
|
+
}));
|
|
495
|
+
});
|
|
496
|
+
describe('when successfully authenticated', () => {
|
|
497
|
+
it('returns the sealed session data', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
498
|
+
const cookiePassword = 'alongcookiesecretmadefortestingsessions';
|
|
499
|
+
const response = yield workos.userManagement.authenticateWithCodeAndVerifier({
|
|
500
|
+
clientId: 'proj_whatever',
|
|
501
|
+
code: 'auth_code_123',
|
|
502
|
+
codeVerifier: 'required_code_verifier',
|
|
503
|
+
session: { sealSession: true, cookiePassword },
|
|
504
|
+
});
|
|
505
|
+
expect(response).toEqual({
|
|
506
|
+
sealedSession: expect.any(String),
|
|
507
|
+
accessToken: expect.any(String),
|
|
508
|
+
authenticationMethod: undefined,
|
|
509
|
+
impersonator: undefined,
|
|
510
|
+
organizationId: undefined,
|
|
511
|
+
refreshToken: undefined,
|
|
512
|
+
user: expect.objectContaining({
|
|
513
|
+
email: 'test01@example.com',
|
|
514
|
+
}),
|
|
515
|
+
});
|
|
516
|
+
}));
|
|
517
|
+
});
|
|
518
|
+
});
|
|
519
|
+
});
|
|
436
520
|
describe('authenticateWithRefreshToken', () => {
|
|
437
521
|
it('sends a refresh_token authentication request', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
438
522
|
(0, test_utils_1.fetchOnce)({
|
package/lib/workos.js
CHANGED
|
@@ -31,7 +31,7 @@ const widgets_1 = require("./widgets/widgets");
|
|
|
31
31
|
const actions_1 = require("./actions/actions");
|
|
32
32
|
const vault_1 = require("./vault/vault");
|
|
33
33
|
const conflict_exception_1 = require("./common/exceptions/conflict.exception");
|
|
34
|
-
const VERSION = '7.
|
|
34
|
+
const VERSION = '7.57.0';
|
|
35
35
|
const DEFAULT_HOSTNAME = 'api.workos.com';
|
|
36
36
|
const HEADER_AUTHORIZATION = 'Authorization';
|
|
37
37
|
const HEADER_IDEMPOTENCY_KEY = 'Idempotency-Key';
|
package/package.json
CHANGED