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?
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 enabled (you should ) You can see how Auth0 goes about this in our node-jwks-rsalibrary. The following resources should be of help as well: