Marplex / flarebase-auth

Firebase/Admin Auth Javascript Library for Cloudflare Workers
https://dev.to/marplex/firebase-authentication-on-cloudflare-workers-24o3
MIT License
88 stars 14 forks source link

Added caching of x509 public keys and toolkit public keys #8

Open clibequilibrium opened 4 months ago

clibequilibrium commented 4 months ago

This PR introduces necessary caching mechanism for Cloudflare network. x509 public keys are now cached using max-age returned from the initial request. And toolkit public keys are cached using Cache API.

Please note, without such caching eventually Google starts to throttle those fetches and in some cases would result in Auth taking more than 20 seconds. I am having some conversations with Firebase staff about it but it seems that Google just doesn't like CF network frequently fetching the keys.