Adding the SDK and initializing it

Nabla JS SDK installation

Add the dependency

Install the SDK by running:

yarn add @nabla/js

or

npm install --save @nabla/js

Initialize the SDK

First, you need to create your instance of the NablaClient:

const nablaClient = new NablaClient({
  configuration: {
    publicApiKey: "YOUR_API_KEY",
    sessionTokenProvider: async (userId: string) => {
      // The SessionTokenProvider callback.
      // This is an async context: call your server to fetch fresh authentication tokens
    },
  },
});

πŸ“˜

Check the authentication guide to know more about the SessionTokenProvider

πŸ“˜

To generate a mobile SDK API key, open your Nabla Console, go to the "Developers" tab, then to the "API keys" section, "Mobile SDK API keys" sub-tab, and click on "Add mobile SDK API key".