# Javascript SDK

### Requirements <a href="#requirements" id="requirements"></a>

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

* [npm](https://www.npmjs.com/) or [yarn](https://yarnpkg.com/)

### Install <a href="#install" id="install"></a>

To install the Bloq Javascript SDK, use either:

`npm install --save @bloq/cloud-sdk`

OR

`yarn add @bloq/cloud-sdk`

### Auth API <a href="#auth-api" id="auth-api"></a>

The auth API helps to simplify the authentication process.

#### Access Token <a href="#access-token" id="access-token"></a>

`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**

```javascript
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
})
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.bloq.com/advanced-documentation/technical-reference/javascript-sdk.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
