JavaScript SDK

This documentation suits Node.js and React.

Introduction

The Akeyless SDK for Node.js makes it easy for you to integrate your Node.js applications, libraries, or scripts with the Akeyless Vault secret management services.
The below Node.js code examples shows a typical sequence of how to integrate secrets into your application.

Install the client

To install the SDK, execute the following:

npm install akeyless --save

And then use it as follows:

const akeyless = require('akeyless');

const client = new akeyless.ApiClient();

// default: public API Gateway
client.basePath = 'https://api.akeyless.io';

// use port 8081 exposed by the deployment:
// client.basePath = 'https://gateway.company.com:8081';

// use port 8080 exposed by the deployment with /v2 prefix:
// client.basePath = 'https://gateway.company.com:8080/v2';

const api = new akeyless.V2Api(client);

api.auth(akeyless.Auth.constructFromObject({
    'admin-email': "[email protected]",
    'admin-password': "strong-password",
})).then(data => data.token)
    .then(token => {
        return api.getSecretValue(akeyless.GetSecretValue.constructFromObject({
            'name': 'my-secret',
        }))
    })
    .then(console.log)
    .catch(console.log)

๐Ÿ“˜

Documentation for API calls

https://github.com/akeylesslabs/akeyless-javascript


Did this page help you?