You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This took me a while to track down. I would sometimes get {"detail":"JWK public Attribute for authorization token not found"} after 7 days of the fastapi instance being up. This hinted towards something expiring.
The firebase.JWKsVerifier class sets self._jwks_to_key = jwks.keys; where jwks is a firebase.JWKS instance. JWKS.firebase is constructed like so:
@classmethoddeffirebase(cls, url: str) ->"JWKS":
""" get and parse json into jwks from endpoint for Firebase, """certs=requests.get(url).json()
keys= {
kid: jwk.construct(publickey, algorithm="RS256")
forkid, publickeyincerts.items()
}
returncls(keys=keys)
What this means is the keys are queried with certs = requests.get(url).json() and stored for as long as the instance is up, but they are never refreshed.
@tokusumi I can raise a PR to fix this if you're too busy; but i'd like your take on how to proceed with it. I'm not sure where to even do the detection for expired keys.
The text was updated successfully, but these errors were encountered:
It's worth noting: The URL https://www.googleapis.com/robot/v1/metadata/x509/[email protected] has an expires header which indicates a ~6 hours TTL. This is much lower than the time they actually disappear; probably on purpose to give time to roll over. My take is that we should store the expires header, and simply update the keys if they have expired (probably with some kind of lock to prevent a bunch of attempts re-querying at the same time).
This took me a while to track down. I would sometimes get
{"detail":"JWK public Attribute for authorization token not found"}
after 7 days of the fastapi instance being up. This hinted towards something expiring.The
firebase.JWKsVerifier
class setsself._jwks_to_key = jwks.keys
; wherejwks
is afirebase.JWKS
instance.JWKS.firebase
is constructed like so:What this means is the keys are queried with
certs = requests.get(url).json()
and stored for as long as the instance is up, but they are never refreshed.@tokusumi I can raise a PR to fix this if you're too busy; but i'd like your take on how to proceed with it. I'm not sure where to even do the detection for expired keys.
The text was updated successfully, but these errors were encountered: