@workos-inc/node 7.59.0 → 7.60.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/user-management/interfaces/authorization-url-options.interface.d.ts +1 -0
- package/lib/user-management/user-management.d.ts +1 -1
- package/lib/user-management/user-management.js +13 -15
- package/lib/user-management/user-management.spec.js +16 -0
- package/lib/workos.js +1 -1
- package/package.json +3 -2
|
@@ -12,6 +12,7 @@ export interface UserManagementAuthorizationURLOptions {
|
|
|
12
12
|
domainHint?: string;
|
|
13
13
|
loginHint?: string;
|
|
14
14
|
provider?: string;
|
|
15
|
+
providerQueryParams?: Record<string, string | boolean | number>;
|
|
15
16
|
providerScopes?: string[];
|
|
16
17
|
prompt?: string;
|
|
17
18
|
redirectUri: string;
|
|
@@ -107,7 +107,7 @@ export declare class UserManagement {
|
|
|
107
107
|
acceptInvitation(invitationId: string): Promise<Invitation>;
|
|
108
108
|
revokeInvitation(invitationId: string): Promise<Invitation>;
|
|
109
109
|
revokeSession(payload: RevokeSessionOptions): Promise<void>;
|
|
110
|
-
getAuthorizationUrl({ connectionId, codeChallenge, codeChallengeMethod, context, clientId, domainHint, loginHint, organizationId, provider, providerScopes, prompt, redirectUri, state, screenHint, }: UserManagementAuthorizationURLOptions): string;
|
|
110
|
+
getAuthorizationUrl({ connectionId, codeChallenge, codeChallengeMethod, context, clientId, domainHint, loginHint, organizationId, provider, providerQueryParams, providerScopes, prompt, redirectUri, state, screenHint, }: UserManagementAuthorizationURLOptions): string;
|
|
111
111
|
getLogoutUrl({ sessionId, returnTo, }: {
|
|
112
112
|
sessionId: string;
|
|
113
113
|
returnTo?: string;
|
|
@@ -19,9 +19,13 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
19
19
|
}
|
|
20
20
|
return t;
|
|
21
21
|
};
|
|
22
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
23
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
24
|
+
};
|
|
22
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
23
26
|
exports.UserManagement = void 0;
|
|
24
27
|
const jose_1 = require("jose");
|
|
28
|
+
const qs_1 = __importDefault(require("qs"));
|
|
25
29
|
const oauth_exception_1 = require("../common/exceptions/oauth.exception");
|
|
26
30
|
const fetch_and_deserialize_1 = require("../common/utils/fetch-and-deserialize");
|
|
27
31
|
const pagination_1 = require("../common/utils/pagination");
|
|
@@ -44,20 +48,13 @@ const send_invitation_options_serializer_1 = require("./serializers/send-invitat
|
|
|
44
48
|
const update_organization_membership_options_serializer_1 = require("./serializers/update-organization-membership-options.serializer");
|
|
45
49
|
const session_1 = require("./session");
|
|
46
50
|
const toQueryString = (options) => {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
});
|
|
55
|
-
}
|
|
56
|
-
if (typeof value === 'string') {
|
|
57
|
-
searchParams.append(key, value);
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
return searchParams.toString();
|
|
51
|
+
return qs_1.default.stringify(options, {
|
|
52
|
+
arrayFormat: 'repeat',
|
|
53
|
+
// sorts the keys alphabetically to maintain backwards compatibility
|
|
54
|
+
sort: (a, b) => a.localeCompare(b),
|
|
55
|
+
// encodes space as + instead of %20 to maintain backwards compatibility
|
|
56
|
+
format: 'RFC1738',
|
|
57
|
+
});
|
|
61
58
|
};
|
|
62
59
|
class UserManagement {
|
|
63
60
|
constructor(workos, ironSessionProvider) {
|
|
@@ -535,7 +532,7 @@ class UserManagement {
|
|
|
535
532
|
yield this.workos.post('/user_management/sessions/revoke', (0, revoke_session_options_interface_1.serializeRevokeSessionOptions)(payload));
|
|
536
533
|
});
|
|
537
534
|
}
|
|
538
|
-
getAuthorizationUrl({ connectionId, codeChallenge, codeChallengeMethod, context, clientId, domainHint, loginHint, organizationId, provider, providerScopes, prompt, redirectUri, state, screenHint, }) {
|
|
535
|
+
getAuthorizationUrl({ connectionId, codeChallenge, codeChallengeMethod, context, clientId, domainHint, loginHint, organizationId, provider, providerQueryParams, providerScopes, prompt, redirectUri, state, screenHint, }) {
|
|
539
536
|
if (!provider && !connectionId && !organizationId) {
|
|
540
537
|
throw new TypeError(`Incomplete arguments. Need to specify either a 'connectionId', 'organizationId', or 'provider'.`);
|
|
541
538
|
}
|
|
@@ -555,6 +552,7 @@ class UserManagement {
|
|
|
555
552
|
domain_hint: domainHint,
|
|
556
553
|
login_hint: loginHint,
|
|
557
554
|
provider,
|
|
555
|
+
provider_query_params: providerQueryParams,
|
|
558
556
|
provider_scopes: providerScopes,
|
|
559
557
|
prompt,
|
|
560
558
|
client_id: clientId,
|
|
@@ -1671,6 +1671,22 @@ describe('UserManagement', () => {
|
|
|
1671
1671
|
});
|
|
1672
1672
|
expect(url).toMatchSnapshot();
|
|
1673
1673
|
});
|
|
1674
|
+
describe('with providerQueryParams', () => {
|
|
1675
|
+
it('generates an authorize url that includes the specified query params', () => {
|
|
1676
|
+
const workos = new workos_1.WorkOS('sk_test_Sz3IQjepeSWaI4cMS4ms4sMuU');
|
|
1677
|
+
const url = workos.userManagement.getAuthorizationUrl({
|
|
1678
|
+
provider: 'GoogleOAuth',
|
|
1679
|
+
clientId: 'proj_123',
|
|
1680
|
+
redirectUri: 'example.com/auth/workos/callback',
|
|
1681
|
+
providerQueryParams: {
|
|
1682
|
+
foo: 'bar',
|
|
1683
|
+
baz: 123,
|
|
1684
|
+
bool: true,
|
|
1685
|
+
},
|
|
1686
|
+
});
|
|
1687
|
+
expect(url).toMatchSnapshot();
|
|
1688
|
+
});
|
|
1689
|
+
});
|
|
1674
1690
|
});
|
|
1675
1691
|
});
|
|
1676
1692
|
describe('with a connectionId', () => {
|
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.60.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
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "7.
|
|
2
|
+
"version": "7.60.0",
|
|
3
3
|
"name": "@workos-inc/node",
|
|
4
4
|
"author": "WorkOS",
|
|
5
5
|
"description": "A Node wrapper for the WorkOS API",
|
|
@@ -41,7 +41,8 @@
|
|
|
41
41
|
"iron-session": "~6.3.1",
|
|
42
42
|
"jose": "~5.6.3",
|
|
43
43
|
"leb": "^1.0.0",
|
|
44
|
-
"pluralize": "8.0.0"
|
|
44
|
+
"pluralize": "8.0.0",
|
|
45
|
+
"qs": "6.14.0"
|
|
45
46
|
},
|
|
46
47
|
"devDependencies": {
|
|
47
48
|
"@peculiar/webcrypto": "^1.4.5",
|