Skip to content

Commit bc75ae6

Browse files
authored
Handle JWT auth method explicitly in service-utils (#6984)
1 parent 8fb8a75 commit bc75ae6

File tree

5 files changed

+14
-4
lines changed

5 files changed

+14
-4
lines changed

.changeset/crazy-states-sleep.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@thirdweb-dev/service-utils": patch
3+
---
4+
5+
handle jwt auth method explicitly

apps/playground-web/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
"@radix-ui/react-switch": "^1.2.2",
2929
"@radix-ui/react-tooltip": "1.2.3",
3030
"@tanstack/react-query": "5.74.4",
31-
"@thirdweb-dev/engine": "^0.0.19",
31+
"@thirdweb-dev/engine": "0.0.19",
3232
"class-variance-authority": "^0.7.1",
3333
"clsx": "^2.1.1",
3434
"date-fns": "4.1.0",

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,11 @@ export function authorizeClient(
2222
authMethod,
2323
};
2424

25+
if (authMethod === "jwt") {
26+
// ignore domains and bundleIds for JWT auth, if the token is valid we'll return the authResult
27+
return authResult;
28+
}
29+
2530
// if there's no project, we'll return the authResult (JWT or teamId auth)
2631
if (!project) {
2732
return authResult;

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,13 @@ export async function authorize(
4949
// Use a separate cache key per auth method.
5050
const cacheKey = authData.incomingServiceApiKey
5151
? // incoming service key + clientId case
52-
`key-v2:service-key:${authData.incomingServiceApiKeyHash}:${authData.clientId ?? "default"}`
52+
`key-v2:service-key:${authData.incomingServiceApiKeyHash}:${authData.clientId ?? "client_default"}`
5353
: authData.secretKeyHash
5454
? // secret key case
5555
`key-v2:secret-key:${authData.secretKeyHash}`
5656
: authData.hashedJWT
5757
? // dashboard jwt case
58-
`key-v2:dashboard-jwt:${authData.hashedJWT}:${authData.teamId ?? "default"}`
58+
`key-v2:dashboard-jwt:${authData.hashedJWT}:${authData.teamId ?? "team_default"}:${authData.clientId ?? "client_default"}`
5959
: authData.clientId
6060
? // clientId case
6161
`key-v2:client-id:${authData.clientId}`

pnpm-lock.yaml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)