Created
September 26, 2021 16:46
-
-
Save aniruddha-adhikary/f5e2ecbdc527bcece8bebf9045e464f6 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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