Skip to content

Commit d238be5

Browse files
committed
feat: add ecosystem heads to extractAuthorizationData
1 parent 0a1d59d commit d238be5

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

packages/service-utils/src/core/authorize/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ import type { AuthorizationResult } from "./types.js";
1212
export type AuthorizationInput = {
1313
secretKey: string | null;
1414
clientId: string | null;
15+
ecosystemId: string | null;
16+
ecosystemPartnerId: string | null;
1517
origin: string | null;
1618
bundleId: string | null;
1719
secretKeyHash: string | null;

packages/service-utils/src/node/index.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ export function extractAuthorizationData(
107107
if (!clientId) {
108108
clientId = requestUrl.searchParams.get("clientId");
109109
}
110+
110111
// bundle id from header is first preference
111112
let bundleId = getHeader(headers, "x-bundle-id");
112113

@@ -115,6 +116,16 @@ export function extractAuthorizationData(
115116
bundleId = requestUrl.searchParams.get("bundleId");
116117
}
117118

119+
let ecosystemId = getHeader(headers, "x-ecosystem-id");
120+
if (!ecosystemId) {
121+
ecosystemId = requestUrl.searchParams.get("ecosystemId");
122+
}
123+
124+
let ecosystemPartnerId = getHeader(headers, "x-ecosystem-partner-id");
125+
if (!ecosystemPartnerId) {
126+
ecosystemPartnerId = requestUrl.searchParams.get("ecosystemPartnerId");
127+
}
128+
118129
let origin = getHeader(headers, "origin");
119130
// if origin header is not available we'll fall back to referrer;
120131
if (!origin) {
@@ -166,6 +177,8 @@ export function extractAuthorizationData(
166177
secretKeyHash,
167178
secretKey,
168179
clientId,
180+
ecosystemId,
181+
ecosystemPartnerId,
169182
origin,
170183
bundleId,
171184
targetAddress: authInput.targetAddress,

0 commit comments

Comments
 (0)