Skip to content

Commit

Permalink
set JWKS cache duration to 5 minutes (#1196)
Browse files Browse the repository at this point in the history
## Description

By default, jose sets a `cooldownDuration` to 30 seconds for JWKS cache.
This PR changes it to 5 minutes.

## Documentation

Does this require changes to the WorkOS Docs? E.g. the [API
Reference](https://workos.com/docs/reference) or code snippets need
updates.

```
[ ] Yes
```

If yes, link a related docs PR and add a docs maintainer as a reviewer.
Their approval is required.
  • Loading branch information
nicknisi authored Jan 10, 2025
1 parent 207686f commit 19d1208
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 6 deletions.
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "7.36.0",
"version": "7.36.1",
"name": "@workos-inc/node",
"author": "WorkOS",
"description": "A Node wrapper for the WorkOS API",
Expand Down Expand Up @@ -72,4 +72,5 @@
"default": "./lib/index.js"
}
}
}
}

4 changes: 2 additions & 2 deletions src/sso/__snapshots__/sso.spec.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ exports[`SSO SSO getProfileAndToken with all information provided sends a reques
"Accept": "application/json, text/plain, */*",
"Authorization": "Bearer sk_test_Sz3IQjepeSWaI4cMS4ms4sMuU",
"Content-Type": "application/x-www-form-urlencoded;charset=utf-8",
"User-Agent": "workos-node/7.36.0/fetch",
"User-Agent": "workos-node/7.36.1/fetch",
}
`;

Expand Down Expand Up @@ -61,7 +61,7 @@ exports[`SSO SSO getProfileAndToken without a groups attribute sends a request t
"Accept": "application/json, text/plain, */*",
"Authorization": "Bearer sk_test_Sz3IQjepeSWaI4cMS4ms4sMuU",
"Content-Type": "application/x-www-form-urlencoded;charset=utf-8",
"User-Agent": "workos-node/7.36.0/fetch",
"User-Agent": "workos-node/7.36.1/fetch",
}
`;

Expand Down
4 changes: 3 additions & 1 deletion src/user-management/user-management.ts
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,9 @@ export class UserManagement {

// Set the JWKS URL. This is used to verify if the JWT is still valid
this.jwks = clientId
? createRemoteJWKSet(new URL(this.getJwksUrl(clientId)))
? createRemoteJWKSet(new URL(this.getJwksUrl(clientId)), {
cooldownDuration: 1000 * 60 * 5,
})
: undefined;
}

Expand Down
2 changes: 1 addition & 1 deletion src/workos.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ import { IronSessionProvider } from './common/iron-session/iron-session-provider
import { Widgets } from './widgets/widgets';
import { Actions } from './actions/actions';

const VERSION = '7.36.0';
const VERSION = '7.36.1';

const DEFAULT_HOSTNAME = 'api.workos.com';

Expand Down

0 comments on commit 19d1208

Please sign in to comment.