Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

getSecretValue returns {0,1} as an object for any valid secret-name #4

Open
mrr4cc00n opened this issue Jul 29, 2022 · 1 comment
Open

Comments

@mrr4cc00n
Copy link

mrr4cc00n commented Jul 29, 2022

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));
@marmol-dev
Copy link

I have the same issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants