Skip to content

Instantly share code, notes, and snippets.

@aniruddha-adhikary
Created September 26, 2021 16:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aniruddha-adhikary/f5e2ecbdc527bcece8bebf9045e464f6 to your computer and use it in GitHub Desktop.
Save aniruddha-adhikary/f5e2ecbdc527bcece8bebf9045e464f6 to your computer and use it in GitHub Desktop.
const axios = require("axios");
exports.handler = async (event) => {
const jwksUrls = [
'https://foo.au.auth0.com/.well-known/jwks.json',
'https://bar.au.auth0.com/.well-known/jwks.json',
'https://baz.au.auth0.com/.well-known/jwks.json',
];
const responses = await Promise.all(jwksUrls.map((url) => axios.get(url)));
const keySets = responses.map(response => response.data.keys.filter(key => key.kid !== key.x5t));
const keys = [].concat(...keySets);
const response = {
keys,
};
return response;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment