@clerk/backend 3.0.0-snapshot.v20251204175016 → 3.0.0-snapshot.v20251211120550
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/dist/api/endpoints/APIKeysApi.d.ts +23 -2
- package/dist/api/endpoints/APIKeysApi.d.ts.map +1 -1
- package/dist/api/endpoints/InstanceApi.d.ts +3 -3
- package/dist/api/endpoints/OrganizationApi.d.ts +2 -2
- package/dist/api/endpoints/SamlConnectionApi.d.ts +3 -3
- package/dist/api/endpoints/UserApi.d.ts +2 -2
- package/dist/api/resources/CommercePlan.d.ts +27 -27
- package/dist/api/resources/CommerceSubscriptionItem.d.ts +6 -6
- package/dist/api/resources/Feature.d.ts +11 -11
- package/dist/api/resources/IdPOAuthAccessToken.d.ts +6 -0
- package/dist/api/resources/IdPOAuthAccessToken.d.ts.map +1 -1
- package/dist/api/resources/JSON.d.ts +4 -4
- package/dist/api/resources/Organization.d.ts +23 -23
- package/dist/api/resources/OrganizationInvitation.d.ts +7 -7
- package/dist/api/resources/OrganizationMembership.d.ts +7 -7
- package/dist/api/resources/SamlConnection.d.ts +4 -4
- package/dist/api/resources/Session.d.ts +2 -2
- package/dist/api/resources/User.d.ts +4 -4
- package/dist/{chunk-777XG3PJ.mjs → chunk-4FN7VCZQ.mjs} +165 -12
- package/dist/chunk-4FN7VCZQ.mjs.map +1 -0
- package/dist/{chunk-QYKVFAML.mjs → chunk-SNA7AD3D.mjs} +8 -7
- package/dist/chunk-SNA7AD3D.mjs.map +1 -0
- package/dist/{chunk-HNJNM32R.mjs → chunk-TCIXZLLW.mjs} +11 -4
- package/dist/{chunk-HNJNM32R.mjs.map → chunk-TCIXZLLW.mjs.map} +1 -1
- package/dist/errors.d.ts +6 -3
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +10 -3
- package/dist/errors.js.map +1 -1
- package/dist/errors.mjs +1 -1
- package/dist/fixtures/index.d.ts +12 -0
- package/dist/fixtures/index.d.ts.map +1 -1
- package/dist/fixtures/machine.d.ts +2 -0
- package/dist/fixtures/machine.d.ts.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +178 -17
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +3 -3
- package/dist/internal.js +178 -17
- package/dist/internal.js.map +1 -1
- package/dist/internal.mjs +3 -3
- package/dist/jwt/assertions.d.ts +1 -1
- package/dist/jwt/assertions.d.ts.map +1 -1
- package/dist/jwt/index.js +6 -5
- package/dist/jwt/index.js.map +1 -1
- package/dist/jwt/index.mjs +2 -2
- package/dist/jwt/verifyJwt.d.ts +5 -0
- package/dist/jwt/verifyJwt.d.ts.map +1 -1
- package/dist/tokens/authObjects.d.ts +1 -1
- package/dist/tokens/clerkRequest.d.ts.map +1 -1
- package/dist/tokens/handshake.d.ts.map +1 -1
- package/dist/tokens/machine.d.ts +23 -0
- package/dist/tokens/machine.d.ts.map +1 -1
- package/dist/tokens/types.d.ts +7 -7
- package/dist/tokens/verify.d.ts +1 -1
- package/dist/tokens/verify.d.ts.map +1 -1
- package/dist/util/shared.d.ts +1 -1
- package/package.json +2 -2
- package/dist/chunk-777XG3PJ.mjs.map +0 -1
- package/dist/chunk-QYKVFAML.mjs.map +0 -1
|
@@ -2,7 +2,7 @@ import { Organization } from '../resources';
|
|
|
2
2
|
import type { OrganizationMembershipRole } from './Enums';
|
|
3
3
|
import type { OrganizationMembershipJSON, OrganizationMembershipPublicUserDataJSON } from './JSON';
|
|
4
4
|
/**
|
|
5
|
-
* The Backend `OrganizationMembership` object is similar to the [`OrganizationMembership`](https://clerk.com/docs/reference/javascript/types/organization-membership) object as it's the model around an
|
|
5
|
+
* The Backend `OrganizationMembership` object is similar to the [`OrganizationMembership`](https://clerk.com/docs/reference/javascript/types/organization-membership) object as it's the model around an Organization membership entity and describes the relationship between users and Organizations. However, the Backend `OrganizationMembership` object is different in that it's used in the [Backend API](https://clerk.com/docs/reference/backend-api/tag/Organization-Memberships#operation/CreateOrganizationMembership){{ target: '_blank' }} and is not directly accessible from the Frontend API.
|
|
6
6
|
*/
|
|
7
7
|
export declare class OrganizationMembership {
|
|
8
8
|
/**
|
|
@@ -10,11 +10,11 @@ export declare class OrganizationMembership {
|
|
|
10
10
|
*/
|
|
11
11
|
readonly id: string;
|
|
12
12
|
/**
|
|
13
|
-
* The
|
|
13
|
+
* The Role of the user.
|
|
14
14
|
*/
|
|
15
15
|
readonly role: OrganizationMembershipRole;
|
|
16
16
|
/**
|
|
17
|
-
* The
|
|
17
|
+
* The Permissions granted to the user in the Organization.
|
|
18
18
|
*/
|
|
19
19
|
readonly permissions: string[];
|
|
20
20
|
/**
|
|
@@ -34,7 +34,7 @@ export declare class OrganizationMembership {
|
|
|
34
34
|
*/
|
|
35
35
|
readonly updatedAt: number;
|
|
36
36
|
/**
|
|
37
|
-
* The
|
|
37
|
+
* The Organization that the user is a member of.
|
|
38
38
|
*/
|
|
39
39
|
readonly organization: Organization;
|
|
40
40
|
/**
|
|
@@ -49,11 +49,11 @@ export declare class OrganizationMembership {
|
|
|
49
49
|
*/
|
|
50
50
|
id: string,
|
|
51
51
|
/**
|
|
52
|
-
* The
|
|
52
|
+
* The Role of the user.
|
|
53
53
|
*/
|
|
54
54
|
role: OrganizationMembershipRole,
|
|
55
55
|
/**
|
|
56
|
-
* The
|
|
56
|
+
* The Permissions granted to the user in the Organization.
|
|
57
57
|
*/
|
|
58
58
|
permissions: string[],
|
|
59
59
|
/**
|
|
@@ -73,7 +73,7 @@ export declare class OrganizationMembership {
|
|
|
73
73
|
*/
|
|
74
74
|
updatedAt: number,
|
|
75
75
|
/**
|
|
76
|
-
* The
|
|
76
|
+
* The Organization that the user is a member of.
|
|
77
77
|
*/
|
|
78
78
|
organization: Organization,
|
|
79
79
|
/**
|
|
@@ -12,11 +12,11 @@ export declare class SamlConnection {
|
|
|
12
12
|
*/
|
|
13
13
|
readonly name: string;
|
|
14
14
|
/**
|
|
15
|
-
* The domain of your
|
|
15
|
+
* The domain of your Organization. Sign in flows using an email with this domain will use the connection.
|
|
16
16
|
*/
|
|
17
17
|
readonly domain: string;
|
|
18
18
|
/**
|
|
19
|
-
* The
|
|
19
|
+
* The Organization ID of the Organization.
|
|
20
20
|
*/
|
|
21
21
|
readonly organizationId: string | null;
|
|
22
22
|
/**
|
|
@@ -97,11 +97,11 @@ export declare class SamlConnection {
|
|
|
97
97
|
*/
|
|
98
98
|
name: string,
|
|
99
99
|
/**
|
|
100
|
-
* The domain of your
|
|
100
|
+
* The domain of your Organization. Sign in flows using an email with this domain will use the connection.
|
|
101
101
|
*/
|
|
102
102
|
domain: string,
|
|
103
103
|
/**
|
|
104
|
-
* The
|
|
104
|
+
* The Organization ID of the Organization.
|
|
105
105
|
*/
|
|
106
106
|
organizationId: string | null,
|
|
107
107
|
/**
|
|
@@ -111,7 +111,7 @@ export declare class Session {
|
|
|
111
111
|
*/
|
|
112
112
|
readonly updatedAt: number;
|
|
113
113
|
/**
|
|
114
|
-
* The ID of the last active
|
|
114
|
+
* The ID of the last active Organization.
|
|
115
115
|
*/
|
|
116
116
|
readonly lastActiveOrganizationId?: string | undefined;
|
|
117
117
|
/**
|
|
@@ -160,7 +160,7 @@ export declare class Session {
|
|
|
160
160
|
*/
|
|
161
161
|
updatedAt: number,
|
|
162
162
|
/**
|
|
163
|
-
* The ID of the last active
|
|
163
|
+
* The ID of the last active Organization.
|
|
164
164
|
*/
|
|
165
165
|
lastActiveOrganizationId?: string | undefined,
|
|
166
166
|
/**
|
|
@@ -116,11 +116,11 @@ export declare class User {
|
|
|
116
116
|
*/
|
|
117
117
|
readonly lastActiveAt: number | null;
|
|
118
118
|
/**
|
|
119
|
-
* A boolean indicating whether the
|
|
119
|
+
* A boolean indicating whether the Organization creation is enabled for the user or not.
|
|
120
120
|
*/
|
|
121
121
|
readonly createOrganizationEnabled: boolean;
|
|
122
122
|
/**
|
|
123
|
-
* An integer indicating the number of
|
|
123
|
+
* An integer indicating the number of Organizations that can be created by the user. If the value is `0`, then the user can create unlimited Organizations. Default is `null`.
|
|
124
124
|
*/
|
|
125
125
|
readonly createOrganizationsLimit: number | null;
|
|
126
126
|
/**
|
|
@@ -247,11 +247,11 @@ export declare class User {
|
|
|
247
247
|
*/
|
|
248
248
|
lastActiveAt: number | null,
|
|
249
249
|
/**
|
|
250
|
-
* A boolean indicating whether the
|
|
250
|
+
* A boolean indicating whether the Organization creation is enabled for the user or not.
|
|
251
251
|
*/
|
|
252
252
|
createOrganizationEnabled: boolean,
|
|
253
253
|
/**
|
|
254
|
-
* An integer indicating the number of
|
|
254
|
+
* An integer indicating the number of Organizations that can be created by the user. If the value is `0`, then the user can create unlimited Organizations. Default is `null`.
|
|
255
255
|
*/
|
|
256
256
|
createOrganizationsLimit: number | null | undefined,
|
|
257
257
|
/**
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
hasValidSignature,
|
|
15
15
|
runtime,
|
|
16
16
|
verifyJwt
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-SNA7AD3D.mjs";
|
|
18
18
|
import {
|
|
19
19
|
MachineTokenVerificationError,
|
|
20
20
|
MachineTokenVerificationErrorCode,
|
|
@@ -22,7 +22,7 @@ import {
|
|
|
22
22
|
TokenVerificationErrorAction,
|
|
23
23
|
TokenVerificationErrorCode,
|
|
24
24
|
TokenVerificationErrorReason
|
|
25
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-TCIXZLLW.mjs";
|
|
26
26
|
import {
|
|
27
27
|
__privateAdd,
|
|
28
28
|
__privateMethod
|
|
@@ -31,7 +31,7 @@ import {
|
|
|
31
31
|
// src/constants.ts
|
|
32
32
|
var API_URL = "https://api.clerk.com";
|
|
33
33
|
var API_VERSION = "v1";
|
|
34
|
-
var USER_AGENT = `${"@clerk/backend"}@${"3.0.0-snapshot.
|
|
34
|
+
var USER_AGENT = `${"@clerk/backend"}@${"3.0.0-snapshot.v20251211120550"}`;
|
|
35
35
|
var MAX_CACHE_LAST_UPDATED_AT_SECONDS = 5 * 60;
|
|
36
36
|
var SUPPORTED_BAPI_VERSION = "2025-11-10";
|
|
37
37
|
var Attributes = {
|
|
@@ -542,13 +542,36 @@ var APIKeysAPI = class extends AbstractAPI {
|
|
|
542
542
|
bodyParams: params
|
|
543
543
|
});
|
|
544
544
|
}
|
|
545
|
-
async
|
|
545
|
+
async get(apiKeyId) {
|
|
546
|
+
this.requireId(apiKeyId);
|
|
547
|
+
return this.request({
|
|
548
|
+
method: "GET",
|
|
549
|
+
path: joinPaths(basePath4, apiKeyId)
|
|
550
|
+
});
|
|
551
|
+
}
|
|
552
|
+
async update(params) {
|
|
546
553
|
const { apiKeyId, ...bodyParams } = params;
|
|
547
554
|
this.requireId(apiKeyId);
|
|
555
|
+
return this.request({
|
|
556
|
+
method: "PATCH",
|
|
557
|
+
path: joinPaths(basePath4, apiKeyId),
|
|
558
|
+
bodyParams
|
|
559
|
+
});
|
|
560
|
+
}
|
|
561
|
+
async delete(apiKeyId) {
|
|
562
|
+
this.requireId(apiKeyId);
|
|
563
|
+
return this.request({
|
|
564
|
+
method: "DELETE",
|
|
565
|
+
path: joinPaths(basePath4, apiKeyId)
|
|
566
|
+
});
|
|
567
|
+
}
|
|
568
|
+
async revoke(params) {
|
|
569
|
+
const { apiKeyId, revocationReason = null } = params;
|
|
570
|
+
this.requireId(apiKeyId);
|
|
548
571
|
return this.request({
|
|
549
572
|
method: "POST",
|
|
550
573
|
path: joinPaths(basePath4, apiKeyId, "revoke"),
|
|
551
|
-
bodyParams
|
|
574
|
+
bodyParams: { revocationReason }
|
|
552
575
|
});
|
|
553
576
|
}
|
|
554
577
|
async getSecret(apiKeyId) {
|
|
@@ -2625,6 +2648,26 @@ var IdPOAuthAccessToken = class _IdPOAuthAccessToken {
|
|
|
2625
2648
|
data.updated_at
|
|
2626
2649
|
);
|
|
2627
2650
|
}
|
|
2651
|
+
/**
|
|
2652
|
+
* Creates an IdPOAuthAccessToken from a JWT payload.
|
|
2653
|
+
* Maps standard JWT claims and OAuth-specific fields to token properties.
|
|
2654
|
+
*/
|
|
2655
|
+
static fromJwtPayload(payload, clockSkewInMs = 5e3) {
|
|
2656
|
+
const oauthPayload = payload;
|
|
2657
|
+
return new _IdPOAuthAccessToken(
|
|
2658
|
+
oauthPayload.jti ?? "",
|
|
2659
|
+
oauthPayload.client_id ?? "",
|
|
2660
|
+
"oauth_token",
|
|
2661
|
+
payload.sub,
|
|
2662
|
+
oauthPayload.scp ?? oauthPayload.scope?.split(" ") ?? [],
|
|
2663
|
+
false,
|
|
2664
|
+
null,
|
|
2665
|
+
payload.exp * 1e3 <= Date.now() - clockSkewInMs,
|
|
2666
|
+
payload.exp,
|
|
2667
|
+
payload.iat,
|
|
2668
|
+
payload.iat
|
|
2669
|
+
);
|
|
2670
|
+
}
|
|
2628
2671
|
};
|
|
2629
2672
|
|
|
2630
2673
|
// src/api/resources/Instance.ts
|
|
@@ -3857,14 +3900,33 @@ var M2M_TOKEN_PREFIX = "mt_";
|
|
|
3857
3900
|
var OAUTH_TOKEN_PREFIX = "oat_";
|
|
3858
3901
|
var API_KEY_PREFIX = "ak_";
|
|
3859
3902
|
var MACHINE_TOKEN_PREFIXES = [M2M_TOKEN_PREFIX, OAUTH_TOKEN_PREFIX, API_KEY_PREFIX];
|
|
3903
|
+
var JwtFormatRegExp = /^[a-zA-Z0-9\-_]+\.[a-zA-Z0-9\-_]+\.[a-zA-Z0-9\-_]+$/;
|
|
3904
|
+
function isJwtFormat(token) {
|
|
3905
|
+
return JwtFormatRegExp.test(token);
|
|
3906
|
+
}
|
|
3907
|
+
var OAUTH_ACCESS_TOKEN_TYPES = ["at+jwt", "application/at+jwt"];
|
|
3908
|
+
function isOAuthJwt(token) {
|
|
3909
|
+
if (!isJwtFormat(token)) {
|
|
3910
|
+
return false;
|
|
3911
|
+
}
|
|
3912
|
+
try {
|
|
3913
|
+
const { data, errors } = decodeJwt(token);
|
|
3914
|
+
return !errors && !!data && OAUTH_ACCESS_TOKEN_TYPES.includes(data.header.typ);
|
|
3915
|
+
} catch {
|
|
3916
|
+
return false;
|
|
3917
|
+
}
|
|
3918
|
+
}
|
|
3860
3919
|
function isMachineTokenByPrefix(token) {
|
|
3861
3920
|
return MACHINE_TOKEN_PREFIXES.some((prefix) => token.startsWith(prefix));
|
|
3862
3921
|
}
|
|
3922
|
+
function isMachineToken(token) {
|
|
3923
|
+
return isMachineTokenByPrefix(token) || isOAuthJwt(token);
|
|
3924
|
+
}
|
|
3863
3925
|
function getMachineTokenType(token) {
|
|
3864
3926
|
if (token.startsWith(M2M_TOKEN_PREFIX)) {
|
|
3865
3927
|
return TokenType.M2MToken;
|
|
3866
3928
|
}
|
|
3867
|
-
if (token.startsWith(OAUTH_TOKEN_PREFIX)) {
|
|
3929
|
+
if (token.startsWith(OAUTH_TOKEN_PREFIX) || isOAuthJwt(token)) {
|
|
3868
3930
|
return TokenType.OAuthToken;
|
|
3869
3931
|
}
|
|
3870
3932
|
if (token.startsWith(API_KEY_PREFIX)) {
|
|
@@ -4291,7 +4353,11 @@ var ClerkRequest = class extends Request {
|
|
|
4291
4353
|
if (origin === initialUrl.origin) {
|
|
4292
4354
|
return createClerkUrl(initialUrl);
|
|
4293
4355
|
}
|
|
4294
|
-
|
|
4356
|
+
try {
|
|
4357
|
+
return createClerkUrl(initialUrl.pathname + initialUrl.search, origin);
|
|
4358
|
+
} catch {
|
|
4359
|
+
return createClerkUrl(initialUrl);
|
|
4360
|
+
}
|
|
4295
4361
|
}
|
|
4296
4362
|
getFirstValueFromHeader(value) {
|
|
4297
4363
|
return value?.split(",")[0];
|
|
@@ -4520,7 +4586,91 @@ async function verifyM2MToken(token, options) {
|
|
|
4520
4586
|
return handleClerkAPIError(TokenType.M2MToken, err, "Machine token not found");
|
|
4521
4587
|
}
|
|
4522
4588
|
}
|
|
4589
|
+
async function verifyJwtOAuthToken(accessToken, options) {
|
|
4590
|
+
let decoded;
|
|
4591
|
+
try {
|
|
4592
|
+
decoded = decodeJwt(accessToken);
|
|
4593
|
+
} catch (e) {
|
|
4594
|
+
return {
|
|
4595
|
+
data: void 0,
|
|
4596
|
+
tokenType: TokenType.OAuthToken,
|
|
4597
|
+
errors: [
|
|
4598
|
+
new MachineTokenVerificationError({
|
|
4599
|
+
code: MachineTokenVerificationErrorCode.TokenInvalid,
|
|
4600
|
+
message: e.message
|
|
4601
|
+
})
|
|
4602
|
+
]
|
|
4603
|
+
};
|
|
4604
|
+
}
|
|
4605
|
+
const { data: decodedResult, errors } = decoded;
|
|
4606
|
+
if (errors) {
|
|
4607
|
+
return {
|
|
4608
|
+
data: void 0,
|
|
4609
|
+
tokenType: TokenType.OAuthToken,
|
|
4610
|
+
errors: [
|
|
4611
|
+
new MachineTokenVerificationError({
|
|
4612
|
+
code: MachineTokenVerificationErrorCode.TokenInvalid,
|
|
4613
|
+
message: errors[0].message
|
|
4614
|
+
})
|
|
4615
|
+
]
|
|
4616
|
+
};
|
|
4617
|
+
}
|
|
4618
|
+
const { header } = decodedResult;
|
|
4619
|
+
const { kid } = header;
|
|
4620
|
+
let key;
|
|
4621
|
+
try {
|
|
4622
|
+
if (options.jwtKey) {
|
|
4623
|
+
key = loadClerkJwkFromPem({ kid, pem: options.jwtKey });
|
|
4624
|
+
} else if (options.secretKey) {
|
|
4625
|
+
key = await loadClerkJWKFromRemote({ ...options, kid });
|
|
4626
|
+
} else {
|
|
4627
|
+
return {
|
|
4628
|
+
data: void 0,
|
|
4629
|
+
tokenType: TokenType.OAuthToken,
|
|
4630
|
+
errors: [
|
|
4631
|
+
new MachineTokenVerificationError({
|
|
4632
|
+
action: TokenVerificationErrorAction.SetClerkJWTKey,
|
|
4633
|
+
message: "Failed to resolve JWK during verification.",
|
|
4634
|
+
code: MachineTokenVerificationErrorCode.TokenVerificationFailed
|
|
4635
|
+
})
|
|
4636
|
+
]
|
|
4637
|
+
};
|
|
4638
|
+
}
|
|
4639
|
+
const { data: payload, errors: verifyErrors } = await verifyJwt(accessToken, {
|
|
4640
|
+
...options,
|
|
4641
|
+
key,
|
|
4642
|
+
headerType: OAUTH_ACCESS_TOKEN_TYPES
|
|
4643
|
+
});
|
|
4644
|
+
if (verifyErrors) {
|
|
4645
|
+
return {
|
|
4646
|
+
data: void 0,
|
|
4647
|
+
tokenType: TokenType.OAuthToken,
|
|
4648
|
+
errors: [
|
|
4649
|
+
new MachineTokenVerificationError({
|
|
4650
|
+
code: MachineTokenVerificationErrorCode.TokenVerificationFailed,
|
|
4651
|
+
message: verifyErrors[0].message
|
|
4652
|
+
})
|
|
4653
|
+
]
|
|
4654
|
+
};
|
|
4655
|
+
}
|
|
4656
|
+
const token = IdPOAuthAccessToken.fromJwtPayload(payload, options.clockSkewInMs);
|
|
4657
|
+
return { data: token, tokenType: TokenType.OAuthToken, errors: void 0 };
|
|
4658
|
+
} catch (error) {
|
|
4659
|
+
return {
|
|
4660
|
+
tokenType: TokenType.OAuthToken,
|
|
4661
|
+
errors: [
|
|
4662
|
+
new MachineTokenVerificationError({
|
|
4663
|
+
code: MachineTokenVerificationErrorCode.TokenVerificationFailed,
|
|
4664
|
+
message: error.message
|
|
4665
|
+
})
|
|
4666
|
+
]
|
|
4667
|
+
};
|
|
4668
|
+
}
|
|
4669
|
+
}
|
|
4523
4670
|
async function verifyOAuthToken(accessToken, options) {
|
|
4671
|
+
if (isJwtFormat(accessToken)) {
|
|
4672
|
+
return verifyJwtOAuthToken(accessToken, options);
|
|
4673
|
+
}
|
|
4524
4674
|
try {
|
|
4525
4675
|
const client = createBackendApiClient(options);
|
|
4526
4676
|
const verifiedToken = await client.idPOAuthAccessToken.verify(accessToken);
|
|
@@ -4542,7 +4692,7 @@ async function verifyMachineAuthToken(token, options) {
|
|
|
4542
4692
|
if (token.startsWith(M2M_TOKEN_PREFIX)) {
|
|
4543
4693
|
return verifyM2MToken(token, options);
|
|
4544
4694
|
}
|
|
4545
|
-
if (token.startsWith(OAUTH_TOKEN_PREFIX)) {
|
|
4695
|
+
if (token.startsWith(OAUTH_TOKEN_PREFIX) || isJwtFormat(token)) {
|
|
4546
4696
|
return verifyOAuthToken(token, options);
|
|
4547
4697
|
}
|
|
4548
4698
|
if (token.startsWith(API_KEY_PREFIX)) {
|
|
@@ -4643,6 +4793,9 @@ var HandshakeService = class {
|
|
|
4643
4793
|
);
|
|
4644
4794
|
url.searchParams.append(constants.QueryParameters.HandshakeReason, reason);
|
|
4645
4795
|
url.searchParams.append(constants.QueryParameters.HandshakeFormat, "nonce");
|
|
4796
|
+
if (this.authenticateContext.sessionToken) {
|
|
4797
|
+
url.searchParams.append(constants.Cookies.Session, this.authenticateContext.sessionToken);
|
|
4798
|
+
}
|
|
4646
4799
|
if (this.authenticateContext.instanceType === "development" && this.authenticateContext.devBrowserToken) {
|
|
4647
4800
|
url.searchParams.append(constants.QueryParameters.DevBrowser, this.authenticateContext.devBrowserToken);
|
|
4648
4801
|
}
|
|
@@ -4935,7 +5088,7 @@ function isTokenTypeInAcceptedArray(acceptsToken, authenticateContext) {
|
|
|
4935
5088
|
let parsedTokenType = null;
|
|
4936
5089
|
const { tokenInHeader } = authenticateContext;
|
|
4937
5090
|
if (tokenInHeader) {
|
|
4938
|
-
if (
|
|
5091
|
+
if (isMachineToken(tokenInHeader)) {
|
|
4939
5092
|
parsedTokenType = getMachineTokenType(tokenInHeader);
|
|
4940
5093
|
} else {
|
|
4941
5094
|
parsedTokenType = TokenType.SessionToken;
|
|
@@ -5345,7 +5498,7 @@ var authenticateRequest = (async (request, options) => {
|
|
|
5345
5498
|
if (!tokenInHeader) {
|
|
5346
5499
|
return handleSessionTokenError(new Error("Missing token in header"), "header");
|
|
5347
5500
|
}
|
|
5348
|
-
if (!
|
|
5501
|
+
if (!isMachineToken(tokenInHeader)) {
|
|
5349
5502
|
return signedOut({
|
|
5350
5503
|
tokenType: acceptsToken,
|
|
5351
5504
|
authenticateContext,
|
|
@@ -5374,7 +5527,7 @@ var authenticateRequest = (async (request, options) => {
|
|
|
5374
5527
|
if (!tokenInHeader) {
|
|
5375
5528
|
return handleSessionTokenError(new Error("Missing token in header"), "header");
|
|
5376
5529
|
}
|
|
5377
|
-
if (
|
|
5530
|
+
if (isMachineToken(tokenInHeader)) {
|
|
5378
5531
|
const parsedTokenType = getMachineTokenType(tokenInHeader);
|
|
5379
5532
|
const mismatchState = checkTokenTypeMismatch(parsedTokenType, acceptsToken, authenticateContext);
|
|
5380
5533
|
if (mismatchState) {
|
|
@@ -5547,4 +5700,4 @@ export {
|
|
|
5547
5700
|
debugRequestState,
|
|
5548
5701
|
createAuthenticateRequest
|
|
5549
5702
|
};
|
|
5550
|
-
//# sourceMappingURL=chunk-
|
|
5703
|
+
//# sourceMappingURL=chunk-4FN7VCZQ.mjs.map
|