LogoLogo
BloqStakeBloqCloudGitHub
  • What is Bloq?
    • Introduction
    • Bloq Account Setup
    • Create Client Keys
    • Accounts Overview
  • Bloq Services
    • BloqNodes
      • CLI
      • Nodes Usage
    • BloqStake
      • Authenticate to Bloq API
        • Authentication
        • API Routes
      • Ethereum
        • Stake ETH
        • Withdraw ETH
        • API Routes
      • Avalanche
        • Stake AVAX
        • API Routes
  • Advanced Documentation
    • Developers Guide
      • Client Tokens
      • BloqNodes Setup
      • Authentication
    • Technical Reference
      • CLI
      • Accounts API
      • Nodes API
      • Blockchain Node API
      • Javascript SDK
    • Knowledge Base
      • How do I connect my Ethereum Node using the Web3 interface?
Powered by GitBook
On this page
  • Requirements
  • Install
  • Auth API

Was this helpful?

  1. Advanced Documentation
  2. Technical Reference

Javascript SDK

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

PreviousBlockchain Node APINextKnowledge Base

Last updated 1 year ago

Was this helpful?

Requirements

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

  • or

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
})
npm
yarn