Authentication

    Authentication


    Article summary


    title: Authentication

    version: 0.5.3
    layout: default
    sdk: core

    # Authentication Module

    Version 0.5.3

    OpenRPC

    This document was generated from an OpenRPC JSON-Schema, and is intended to provide a human readable overview and examples of the methods contained in the module.

    For the full schema, see the link below.

    Schema
    authentication.json

    Table of Contents

    Usage

    To use the Authentication module, you can import it into your project from the Firebolt SDK:

    import { Authentication } from '@firebolt-js/sdk'
    

    Overview

    A module for acquiring authentication tokens.

    Events

    Methods

    token

    Get a specific type of authentication token

    function token(type: TokenType, options?: object): Promise<object>
    

    Parameters

    ParamTypeRequiredSummary
    typeTokenTypetrueWhat type of token to get
    optionsobjectfalseAdditional options for acquiring the token.

    Promise Resolution

    the token value, type, and expiration

    FieldTypeDescription
    valuestring
    expiresstring
    typestring

    Examples

    ##### Acquire a Firebolt platform token

    JavaScript
    import { Authentication } from '@firebolt-js/sdk'
    
    Authentication.token("platform", null)
        .then(token => {
            console.log(token)
        })
    

    Value of token

    {
      "value": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c",
      "expires": "2022-04-23T18:25:43.511Z",
      "type": "platform"
    }
    
    JSON-RPC

    ###### Request

    {
      "jsonrpc": "2.0",
      "id": 1,
      "method": "authentication.token",
      "params": {
        "type": "platform"
      }
    }
    

    ###### Response

    {
      "jsonrpc": "2.0",
      "id": 1,
      "result": {
        "value": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c",
        "expires": "2022-04-23T18:25:43.511Z",
        "type": "platform"
      }
    }
    

    ##### Acquire a Firebolt device identity (XACT) token

    JavaScript
    import { Authentication } from '@firebolt-js/sdk'
    
    Authentication.token("device", null)
        .then(token => {
            console.log(token)
        })
    

    Value of token

    {
      "value": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c",
      "expires": "2022-04-23T18:25:43.511Z",
      "type": "device"
    }
    
    JSON-RPC

    ###### Request

    {
      "jsonrpc": "2.0",
      "id": 1,
      "method": "authentication.token",
      "params": {
        "type": "device"
      }
    }
    

    ###### Response

    {
      "jsonrpc": "2.0",
      "id": 1,
      "result": {
        "value": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c",
        "expires": "2022-04-23T18:25:43.511Z",
        "type": "device"
      }
    }
    

    ##### Acquire a Firebolt distributor token

    JavaScript
    import { Authentication } from '@firebolt-js/sdk'
    
    Authentication.token("distributor", {"clientId":"xyz"})
        .then(token => {
            console.log(token)
        })
    

    Value of token

    {
      "value": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c",
      "expires": "2022-04-23T18:25:43.511Z",
      "type": "distributor",
      "data": {
        "tid": "EB00E9230AB2A35F57DB4EFDDC4908F6446D38F08F4FF0BD57FE6A61E21EEFD9",
        "scope": "scope"
      }
    }
    
    JSON-RPC

    ###### Request

    {
      "jsonrpc": "2.0",
      "id": 1,
      "method": "authentication.token",
      "params": {
        "type": "distributor",
        "options": {
          "clientId": "xyz"
        }
      }
    }
    

    ###### Response

    {
      "jsonrpc": "2.0",
      "id": 1,
      "result": {
        "value": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c",
        "expires": "2022-04-23T18:25:43.511Z",
        "type": "distributor",
        "data": {
          "tid": "EB00E9230AB2A35F57DB4EFDDC4908F6446D38F08F4FF0BD57FE6A61E21EEFD9",
          "scope": "scope"
        }
      }
    }
    

    Schemas

    TokenType

    type TokenType = 'platform' | 'device' | 'distributor'
    


    Was this article helpful?

    What's Next