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