-
Notifications
You must be signed in to change notification settings - Fork 233
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Key loaded via interceptor causing a type error #293
Comments
Hi @thomas-yaa - thanks for raising this The return value of
Your code probably works the first time when the cache is empty, then fails when the cache is being restored. If you want to cache the JWKS in a file system you'll need to fetch it yourself and save it in the interceptor, eg async function loadKeys(jwksUri, cacheDir = KEY_FILE_CACHE) {
try {
if (fs.existsSync(cacheDir)) {
// load JWKS from cache
}
} catch (e) {
console.debug(`Problem reading keys from disk cache, ${e}`);
}
const jwks = await request(jwksUri);
cacheKeys(jwks);
return jwks;
} Also you don't need this code: const getSigningKey: (kid: string) => Promise<jwksClient.SigningKey> =
util.promisify(client.getSigningKey);
getSigningKey.bind(jwksClient); As |
Closing due to inactivity, ping me if you want to reopen |
Describe the problem
Returning keys from the function passed in for
getKeysInterceptor
is causing a type error.The keys in question are fetched via
getSigningKey
, direct from auth0.What was the expected behavior?
Loaded keys should work without an error.
Reproduction
Assuming the following code (in a Lambda authorizer):
Environment
SigningKey
butJSONWebKey
lacks the method,getPublicKey
so trips the errorThe text was updated successfully, but these errors were encountered: