File tree Expand file tree Collapse file tree 4 files changed +32
-0
lines changed
packages/service-utils/src Expand file tree Collapse file tree 4 files changed +32
-0
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ " @thirdweb-dev/service-utils " : patch
3+ ---
4+
5+ Adds ecosystem headers to extractAuthorizationData result
Original file line number Diff line number Diff line change @@ -105,6 +105,16 @@ export async function extractAuthorizationData(
105105 bundleId = requestUrl . searchParams . get ( "bundleId" ) ;
106106 }
107107
108+ let ecosystemId = headers . get ( "x-ecosystem-id" ) ;
109+ if ( ! ecosystemId ) {
110+ ecosystemId = requestUrl . searchParams . get ( "ecosystemId" ) ;
111+ }
112+
113+ let ecosystemPartnerId = headers . get ( "x-ecosystem-partner-id" ) ;
114+ if ( ! ecosystemPartnerId ) {
115+ ecosystemPartnerId = requestUrl . searchParams . get ( "ecosystemPartnerId" ) ;
116+ }
117+
108118 let origin = headers . get ( "origin" ) ;
109119 // if origin header is not available we'll fall back to referrer;
110120 if ( ! origin ) {
@@ -150,6 +160,8 @@ export async function extractAuthorizationData(
150160 hashedJWT : jwt ? await hashSecretKey ( jwt ) : null ,
151161 secretKey,
152162 clientId,
163+ ecosystemId,
164+ ecosystemPartnerId,
153165 origin,
154166 bundleId,
155167 secretKeyHash,
Original file line number Diff line number Diff line change @@ -12,6 +12,8 @@ import type { AuthorizationResult } from "./types.js";
1212export 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 ;
Original file line number Diff line number Diff 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 ,
You can’t perform that action at this time.
0 commit comments