Open
Description
Imagine the following code:
"use strict";
const axios = require("axios");
const jose = require("node-jose");
async function working(url) {
const jwksResponse = await axios.get(url);
// do i need to iterate through the keys?
return await jose.JWK.createKeyStore().add(jwksResponse.data.keys[0], "jwk");
}
async function notWorking(url) {
const jwksResponse = await axios.get(url);
return await jose.JWK.createKeyStore().add(jwksResponse.data, "jwk");
}
async function main() {
const publicKeyStore = await working(
"https://login.microsoftonline.com/common/discovery/v2.0/keys"
);
console.log(publicKeyStore);
publicKeyStore = await notWorking(
"https://login.microsoftonline.com/common/discovery/v2.0/keys"
);
}
main();
My expectation was:
- Maybe a convenience function to fetch the keys
- A way for all the keys to be added without iterating through the retrieved keys
Am I missing something please?
Metadata
Metadata
Assignees
Labels
No labels