Fetching and storing JWKS within a worker

Working on a project building a small application that requires user authentication to interact with various endpoints hosted on CF Worker. Using Auth0 for all user management, and last night was able to get a simple "Hello World" setup that can authenticate a user's token when interacting with the worker Part of the auth process is using a JWKS provided by Auth0 to verify the provided access token. The JWKS is easily available through an Auth0 endpoint, and currently things are wired up to just fetch the JWKS on every request. Obviously, this won't scale beyond even a couple users before Auth0 starts to rate limit the JWKS endpoint - so some sort of caching of the JWKS seems to be necessary. Still very new to CF Workers, but my initial thought was to use either KV or Durable Objects to store the JWKS object, with a wrapper that can handle updating it when necessary. Durable Objects seem to be the right approach here, but I'm curious for others thoughts for this use case (or if I'm just fundamentally misunderstanding the problem and there is an easier solution!)
0 Replies
No replies yetBe the first to reply to this messageJoin
Want results from more Discord servers?
Add your server