@workos-inc/node 7.17.0 → 7.18.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/authenticate-with-refresh-token-options.interface.d.ts +2 -0
- package/lib/user-management/interfaces/refresh-and-seal-session-data.interface.d.ts +4 -0
- package/lib/user-management/interfaces/refresh-and-seal-session-data.interface.js +4 -0
- package/lib/user-management/serializers/authenticate-with-refresh-token.options.serializer.js +1 -0
- package/lib/user-management/user-management.js +2 -2
- package/lib/workos.js +1 -1
- package/package.json +3 -2
package/lib/user-management/interfaces/authenticate-with-refresh-token-options.interface.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { AuthenticateWithOptionsBase, SerializedAuthenticateWithOptionsBase } from './authenticate-with-options-base.interface';
|
|
2
2
|
export interface AuthenticateWithRefreshTokenOptions extends AuthenticateWithOptionsBase {
|
|
3
3
|
refreshToken: string;
|
|
4
|
+
organizationId?: string;
|
|
4
5
|
}
|
|
5
6
|
export interface AuthenticateUserWithRefreshTokenCredentials {
|
|
6
7
|
clientSecret: string | undefined;
|
|
@@ -8,4 +9,5 @@ export interface AuthenticateUserWithRefreshTokenCredentials {
|
|
|
8
9
|
export interface SerializedAuthenticateWithRefreshTokenOptions extends SerializedAuthenticateWithOptionsBase {
|
|
9
10
|
grant_type: 'refresh_token';
|
|
10
11
|
refresh_token: string;
|
|
12
|
+
organization_id: string | undefined;
|
|
11
13
|
}
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
export declare enum RefreshAndSealSessionDataFailureReason {
|
|
2
|
+
/**
|
|
3
|
+
* @deprecated To be removed in a future major version.
|
|
4
|
+
*/
|
|
2
5
|
INVALID_SESSION_COOKE = "invalid_session_cookie",
|
|
6
|
+
INVALID_SESSION_COOKIE = "invalid_session_cookie",
|
|
3
7
|
NO_SESSION_COOKIE_PROVIDED = "no_session_cookie_provided",
|
|
4
8
|
INVALID_GRANT = "invalid_grant",
|
|
5
9
|
ORGANIZATION_NOT_AUTHORIZED = "organization_not_authorized"
|
|
@@ -3,7 +3,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.RefreshAndSealSessionDataFailureReason = void 0;
|
|
4
4
|
var RefreshAndSealSessionDataFailureReason;
|
|
5
5
|
(function (RefreshAndSealSessionDataFailureReason) {
|
|
6
|
+
/**
|
|
7
|
+
* @deprecated To be removed in a future major version.
|
|
8
|
+
*/
|
|
6
9
|
RefreshAndSealSessionDataFailureReason["INVALID_SESSION_COOKE"] = "invalid_session_cookie";
|
|
10
|
+
RefreshAndSealSessionDataFailureReason["INVALID_SESSION_COOKIE"] = "invalid_session_cookie";
|
|
7
11
|
RefreshAndSealSessionDataFailureReason["NO_SESSION_COOKIE_PROVIDED"] = "no_session_cookie_provided";
|
|
8
12
|
// API OauthErrors for refresh tokens
|
|
9
13
|
RefreshAndSealSessionDataFailureReason["INVALID_GRANT"] = "invalid_grant";
|
package/lib/user-management/serializers/authenticate-with-refresh-token.options.serializer.js
CHANGED
|
@@ -6,6 +6,7 @@ const serializeAuthenticateWithRefreshTokenOptions = (options) => ({
|
|
|
6
6
|
client_id: options.clientId,
|
|
7
7
|
client_secret: options.clientSecret,
|
|
8
8
|
refresh_token: options.refreshToken,
|
|
9
|
+
organization_id: options.organizationId,
|
|
9
10
|
ip_address: options.ipAddress,
|
|
10
11
|
user_agent: options.userAgent,
|
|
11
12
|
});
|
|
@@ -220,7 +220,7 @@ class UserManagement {
|
|
|
220
220
|
if (!session.refreshToken || !session.user) {
|
|
221
221
|
return {
|
|
222
222
|
authenticated: false,
|
|
223
|
-
reason: refresh_and_seal_session_data_interface_1.RefreshAndSealSessionDataFailureReason.
|
|
223
|
+
reason: refresh_and_seal_session_data_interface_1.RefreshAndSealSessionDataFailureReason.INVALID_SESSION_COOKIE,
|
|
224
224
|
};
|
|
225
225
|
}
|
|
226
226
|
try {
|
|
@@ -232,7 +232,7 @@ class UserManagement {
|
|
|
232
232
|
if (!sealedSession) {
|
|
233
233
|
return {
|
|
234
234
|
authenticated: false,
|
|
235
|
-
reason: refresh_and_seal_session_data_interface_1.RefreshAndSealSessionDataFailureReason.
|
|
235
|
+
reason: refresh_and_seal_session_data_interface_1.RefreshAndSealSessionDataFailureReason.INVALID_SESSION_COOKIE,
|
|
236
236
|
};
|
|
237
237
|
}
|
|
238
238
|
return { authenticated: true, sealedSession };
|
package/lib/workos.js
CHANGED
|
@@ -27,7 +27,7 @@ const bad_request_exception_1 = require("./common/exceptions/bad-request.excepti
|
|
|
27
27
|
const http_client_1 = require("./common/net/http-client");
|
|
28
28
|
const subtle_crypto_provider_1 = require("./common/crypto/subtle-crypto-provider");
|
|
29
29
|
const fetch_client_1 = require("./common/net/fetch-client");
|
|
30
|
-
const VERSION = '7.
|
|
30
|
+
const VERSION = '7.18.0';
|
|
31
31
|
const DEFAULT_HOSTNAME = 'api.workos.com';
|
|
32
32
|
const HEADER_AUTHORIZATION = 'Authorization';
|
|
33
33
|
const HEADER_IDEMPOTENCY_KEY = 'Idempotency-Key';
|