Javascript SDK

The Bloq Javascript SDK enables you to work with Bloq services easily by simplifying authentication.

Requirements

The Javascript SDK has the following system requirements to install the library:

Install

To install the Bloq Javascript SDK, use either:

npm install --save @bloq/cloud-sdk

OR

yarn add @bloq/cloud-sdk

Auth API

The auth API helps to simplify the authentication process.

Access Token

accessToken()

This method returns a promise that resolves in a new created access token using the provided client ID and secret.

The Access Token is required to interact with Bloq services. It usually travels in an Authorization header value.

Code sample

const { auth } = require('@bloq/cloud-sdk')

const clientId = 'CLIENT_ID'
const clientSecret = 'CLIENT_SECRET'

const client = auth({ clientId, clientSecret })

client.accessToken().then(function (accessToken) {
  // Use access token
})

Last updated