Open babadofar opened 7 years ago
Yes, this needs to be patched in the node sdk. In the meantime, this is how i get a user's api keys:
//Get available api key field ids
var apiKeyFields = Object.keys(req.user.profile).filter(function (key) {
return key.match(/stormpathApiKey_[0-9]+/);
});
//Return api keys array
var apiKeys = {
size: 0,
items: []
};
//Get values based on fields ids
apiKeyFields.forEach(function (key) {
//Stored in customdata as a single string splitted by :
apikey = req.user.profile[key].split(':');
if(apikey[1]) {
apiKeys.items.push({
id: apikey[0],
secret: apikey[1]
});
apiKeys.size++;
}
});
//Return if theres any
if(apiKeys.size>0) {
return res.status(200).send({status: 'success', code: 'api_keys_found', message: 'Api key found.', data: apiKeys});
} else {
return res.status(404).send({status: 'fail', code: 'no_api_keys', message: "You don't have api keys"});
}
Hi, I'm trying to migrate a Stormpath application that relied heavily on using api keys, and was relieved to see that you had implemented a solution for this on top of Okta. However, I see a bug when trying to call Account. getApiKeys -> apiKeys are not populated.
Is this something you intend to support going forwards? I find the migrated apikeys now in customdata. In the mean time I will just read them from there.
This can be easily tested using the express-stormpath-sample-project, and initing stormpath like this:
Code breaks here: https://github.com/stormpath/stormpath-sdk-node/blob/1.0.0-rc5/lib/resource/Account.js#L447