pyjwt icon indicating copy to clipboard operation
pyjwt copied to clipboard

Document and/or rename misleading arguments of PyJWKClient

Open pakal opened this issue 7 months ago • 2 comments

The parameters of PyJWKClient are a bit misleading, as cache_keys/max_cached_keys only apply to PUBLIC KEYS and cache them FOREVER, whereas cache_jwk_set/lifespan really apply to the actual fetching/caching of JWK sets (but have no impact on the PUBLIC KEY caching)

Expected Result

If PyJWKClient is well part of the publci API (since it's quoted in tutorials), either this two-tier (and a bit complex) system should be documented and explained, and maybe arguments should be renamed (with deprecated aliases) to make it more explicitly which of these does what.

Actual Result

Our implementer had troubles grasping the API ^^"

pakal avatar May 27 '25 07:05 pakal

Is PyJWKClient documented anywhere at all? I see it used in a few places in the usage examples section of the docs https://pyjwt.readthedocs.io/en/stable/usage.html, but not anywhere in the API reference https://pyjwt.readthedocs.io/en/stable/api.html.

jarrod-cummings avatar Aug 09 '25 01:08 jarrod-cummings

Yes, docs are quite sparse about it (except exampels like PyJWKClient), and by looking at the code, it gets easily miunderstood alas ^^'

pakal avatar Aug 21 '25 19:08 pakal