--- title: "Authentication" slug: "100-core-authentication" updated: 2025-05-23T20:10:26Z published: 2025-05-23T20:10:26Z canonical: "docs.developer.comcast.com/100-core-authentication" --- > ## Documentation Index > Fetch the complete documentation index at: https://docs.developer.comcast.com/llms.txt > Use this file to discover all available pages before exploring further. # Authentication **Authentication Module 1.0.0 | Core SDK** ## 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. ## Methods ### device Get a device token scoped to the current app. ``` function device(): Promise ``` Promise resolution: ``` string ``` Capabilities: | Role | Capability | | --- | --- | | uses | xrn:firebolt:capability:token:device | #### Examples Acquire a Firebolt device identity token JavaScript: ``` import { Authentication } from '@firebolt-js/sdk' Authentication.device() .then(token => { console.log(token) }) ``` Value of `token`: ``` "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c" ``` **JSON-RPC:** Request: ``` { "jsonrpc": "2.0", "id": 1, "method": "Authentication.device", "params": {} } ``` Response: ``` { "jsonrpc": "2.0", "id": 1, "result": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c" } ``` --- ### root Get a root device token. ``` function root(): Promise ``` Promise resolution: ``` string ``` Capabilities: | Role | Capability | | --- | --- | | uses | xrn:firebolt:capability:token:root | #### Examples Acquire a Firebolt root device identity token JavaScript: ``` import { Authentication } from '@firebolt-js/sdk' Authentication.root() .then(token => { console.log(token) }) ``` Value of `token`: ``` "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c" ``` **JSON-RPC:** Request: ``` { "jsonrpc": "2.0", "id": 1, "method": "Authentication.root", "params": {} } ``` Response: ``` { "jsonrpc": "2.0", "id": 1, "result": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c" } ``` --- ### session Get a destributor session token. ``` function session(): Promise ``` Promise resolution: ``` string ``` Capabilities: | Role | Capability | | --- | --- | | uses | xrn:firebolt:capability:token:session | #### Examples Acquire a distributor session token JavaScript: ``` import { Authentication } from '@firebolt-js/sdk' Authentication.session() .then(token => { console.log(token) }) ``` Value of `token`: ``` "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c" ``` **JSON-RPC:** Request: ``` { "jsonrpc": "2.0", "id": 1, "method": "Authentication.session", "params": {} } ``` Response: ``` { "jsonrpc": "2.0", "id": 1, "result": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c" } ``` --- ### token Get a specific `type` of authentication token ``` function token(type: TokenType, options?: object): Promise ``` Parameters: | Param | Type | Required | Description | | --- | --- | --- | --- | | `type` | [`TokenType`](/docs/100-core-authentication#tokentype) | true | What type of token to get values: `'platform' \| 'device' \| 'distributor'` | | , | `options` | `object` | false | Promise resolution: | Property | Type | Description | | --- | --- | --- | | `value` | string | | | `expires` | string | | | `type` | string | | Capabilities: | Role | Capability | | --- | --- | | uses | xrn:firebolt:capability:token:platform | #### 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 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": "platform" } ``` **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": "platform" } ``` **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" } } } ``` --- ## Types ### TokenType ``` enum TokenType { PLATFORM = 'platform', DEVICE = 'device', DISTRIBUTOR = 'distributor' } ``` ---