File tree Expand file tree Collapse file tree 2 files changed +16
-6
lines changed
packages/service-utils/src/core Expand file tree Collapse file tree 2 files changed +16
-6
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ " @thirdweb-dev/service-utils " : patch
3+ ---
4+
5+ Prioritize JWT over service API keys in authentication
Original file line number Diff line number Diff line change @@ -258,12 +258,17 @@ export async function fetchTeamAndProject(
258258 method : "GET" ,
259259 headers : {
260260 ...( authData . secretKey ? { "x-secret-key" : authData . secretKey } : { } ) ,
261- ...( authData . jwt ? { Authorization : `Bearer ${ authData . jwt } ` } : { } ) ,
262- // use the incoming service api key if it exists, otherwise use the service api key
263- // this is done to ensure that the incoming service API key is VALID in the first place
264- "x-service-api-key" : incomingServiceApiKey
265- ? incomingServiceApiKey
266- : serviceApiKey ,
261+ ...( authData . jwt
262+ ? { Authorization : `Bearer ${ authData . jwt } ` }
263+ : // if the JWT is not present ww'll use service api keys, if there is a JWT present we'll always use the JWT
264+ {
265+ // use the incoming service api key if it exists, otherwise use the service api key
266+ // this is done to ensure that the incoming service API key is VALID in the first place
267+ "x-service-api-key" : incomingServiceApiKey
268+ ? incomingServiceApiKey
269+ : serviceApiKey ,
270+ } ) ,
271+
267272 "content-type" : "application/json" ,
268273 } ,
269274 } ) ;
You can’t perform that action at this time.
0 commit comments