-
Notifications
You must be signed in to change notification settings - Fork 1
Description
We started a POC with this javascript SDK, I must say the documentation is not up to date (on the main website) and I believe it lacks clarity, nevertheless, we achieved the first flows working but now we ran into this issue, essentially it doesn't return the secret value instead returns this object: {0,1}
. No errors or warnings. Perhaps we are missing something but as I said the documentation doesn't specify anything for the consumption of the API call. Below is the code we are using and some other specifications. Thanks in advance and let me know if you need any other information:
const akeyless = require('akeyless');
const client = new akeyless.ApiClient();
client.basePath = 'here the akeyless GW or the public API, both returns same result'
const api = new akeyless.V2Api(client);
api.auth({
'access-id': 'admin access id',
'access-key': 'admin access key'
}).then(res => {
api.listItems({
token: res.token,
path: 'path to your static secrets'
}).then((data) => {
data.items.forEach(item => {
console.log(item.item_name)
api.getSecretValue({ name: item.item_name, token: res.token }).then((data) => {
console.log('API called successfully. Returned data: ' + JSON.stringify(data, null, 4));
}, (error) => {
console.error(error);
});
}
)
}, (error) => {
console.error(error);
});
})
The getSecretValue
call returns an object, when printing the object { "0": "{", "1": "}" }
Once again, thanks in advance and reach out if I can help in any way, we would like to be able to use this SDK.
In addition to the above if you don't use the SDK it works just fine e.g.:
const options = {
method: 'POST',
headers: { Accept: 'application/json', 'Content-Type': 'application/json' },
body: JSON.stringify({
names: [
item.item_name
],
token: res.token
})
};
fetch('your-gw/get-secret-value', options)
.then(secret => secret.json())
.then(secret => console.log(secret))
.catch(err => console.error(err));