Skip to content

Commit

Permalink
fix(clerk-sdk-node): Add jwtKey in api envs and use it redwood compat…
Browse files Browse the repository at this point in the history
…ibility
  • Loading branch information
dimkl committed Jul 4, 2023
1 parent 670a761 commit 1957b3e
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/lucky-panthers-draw.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@clerk/clerk-sdk-node': patch
---

Load `jwtKey` from `CLERK_JWT_KEY` env variable
3 changes: 2 additions & 1 deletion packages/sdk-node/src/clerkClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,11 @@ export function Clerk(options: ClerkOptions) {

const createBasePropForRedwoodCompatibility = () => {
const verifySessionToken = (token: string) => {
const { jwtKey } = loadApiEnv();
const { payload } = decodeJwt(token);
return _verifyToken(token, {
issuer: payload.iss,
jwtKey: process.env.CLERK_JWT_KEY,
jwtKey,
});
};
return { base: { verifySessionToken } };
Expand Down
1 change: 1 addition & 0 deletions packages/sdk-node/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,6 @@ export const loadApiEnv = () => {
proxyUrl: process.env.CLERK_PROXY_URL || '',
signInUrl: process.env.CLERK_SIGN_IN_URL || '',
isSatellite: process.env.CLERK_IS_SATELLITE === 'true',
jwtKey: process.env.CLERK_JWT_KEY || '',
};
};

0 comments on commit 1957b3e

Please sign in to comment.