# Is the endpoint to get the JWK for token validation rate limited?

**URL:** <https://community.auth0.com/t/is-the-endpoint-to-get-the-jwk-for-token-validation-rate-limited/91483>\
**Category:** Get Help\
**Tags:** jwks, rsa, jwt-validation, api, key\
**Created:** [September 28, 2022, 5:42pm UTC](https://community.auth0.com/t/is-the-endpoint-to-get-the-jwk-for-token-validation-rate-limited/91483 "2022-09-28T17:42:46Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![a.saad](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/a.saad/32/36224_2.png) [@a.saad](https://community.auth0.com/u/a.saad)\
**Post date:** [September 28, 2022, 5:42pm UTC](https://community.auth0.com/t/is-the-endpoint-to-get-the-jwk-for-token-validation-rate-limited/91483/1 "2022-09-28T17:42:46Z")

</div>

Hello,

I have a backend service that needs to validate tokens. I read [this guide](https://auth0.com/blog/navigating-rs256-and-jwks/) and it mentions that I should hit the endpoint:

`https://your-tenant.auth0.com/.well-known/jwks.json`

in order to retrieve the public key. What the article didn’t mention though was whether the endpoint is subject to rate limits or not.

So if I have a medium-sized application, ~30K active users, will it be ok to get the JWK from the endpoint each time I want to validate a token or should I cache it? And if I’m supposed to cache the key, how often should I refresh my cache?

Thanks

---

<div class="post-metadata">

**Author:** ![ty.frith](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/ty.frith/32/58484_2.png) [@ty.frith](https://community.auth0.com/u/ty.frith)\
**Post date:** [September 28, 2022, 6:08pm UTC](https://community.auth0.com/t/is-the-endpoint-to-get-the-jwk-for-token-validation-rate-limited/91483/3 "2022-09-28T18:08:16Z")

</div>

Hey there @a.saad welcome to the community!

> [@a.saad](#):
>
> in order to retrieve the public key. What the article didn’t mention though was whether the endpoint is subject to rate limits or not.
> 
> So if I have a medium-sized application, ~30K active users, will it be ok to get the JWK from the endpoint each time I want to validate a token or should I cash it? And if I’m supposed to cash the key, how often should I refresh my cash?

The `/jwks` endpoint is indeed subject to rate limits, so you’ll definitely want to implement some sort of caching. It really depends on your application needs and whether or not you have [signing key rotation](https://auth0.com/docs/get-started/tenant-settings/signing-keys/rotate-signing-keys) enabled (you should 🙂) You can see how Auth0 goes about this in our `node-jwks-rsa` [library](https://github.com/auth0/node-jwks-rsa#caching). The following resources should be of help as well:

> **[Token Best Practices](https://auth0.com/docs/secure/tokens/token-best-practices#signing-keys)**
>
> Lists best practices when using tokens in authentication and authorization.

> [@Caching JWKS signing key](https://community.auth0.com/t/caching-jwks-signing-key/17654/2):
>
> Hi @benji. (This response was updated on April 2021 to reflect signing keys rotation and updated guidance on caching). Auth0 nows support signing key rotation initiated by tenant admins (see [Signing Keys](https://auth0.com/docs/tokens/manage-signing-keys) for details). A tenant’s JWKS resource will have the current key and the “next” key, so applications that prepare in advance for a key rotation. The JWKS resource will return the same set of keys most of the time. Applications should cache these resources, but they also need to be prepared to…

Hope this helps!

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/auth0/original/3X/b/5/b560f266932fcce5d57f09a6595bd50518cae3f3.jpeg) [@system](https://community.auth0.com/u/system)\
**Post date:** [October 12, 2022, 6:08pm UTC](https://community.auth0.com/t/is-the-endpoint-to-get-the-jwk-for-token-validation-rate-limited/91483/4 "2022-10-12T18:08:17Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
