Skip to content

Authentication

API requests require an authentication header with a JWT token received from the AWS Cognito service. You will need a user login and password to send such a request. We recommend using the AWS SDK library as a handy helper. List of official AWS SDK in multiple programming languages

We have prepared example code which shows the authorization flow written in Node.js. For the full working sample project, see the Unleash Live API Samples GitHub repository.

Prerequisites: Node.js v18 or later. Install dependencies with npm install under the javascript/ directory.

Environment variables and Cognito pool settings are defined in env.js. User credentials are defined in user.js — replace the placeholder values with your own login email and password (the same credentials used to log in to cloud.unleashlive.com).

The cognito.js module provides helper functions for:

  • Initialising the AWS SDK client with identity pool credentials
  • Creating a Cognito user pool and user instances
  • Decoding JWT tokens
  • Building authentication details

The actions.js module uses the Cognito helpers to authenticate a user. On success it returns the access token, ID token, refresh token, and custom claims (identityId, companyId, teamId).

An example sign-in script can be run from any of the sample entry points (e.g. media-drive, flights).

Every GraphQL request must include the header authorization with the ID token. Every REST request must include the header X-Amz-Cognito-Security-Token with the security token.

If you are using another programming language, you can use the following command in your terminal to generate a security token:

Terminal window
aws cognito-idp initiate-auth --auth-flow USER_PASSWORD_AUTH --region ap-southeast-2 --client-id 7jhe1lfkb5pvhbkicc3d14m0ej --auth-parameters USERNAME=<USER_LOGIN_EMAIL>,PASSWORD=<PASSWORD>

This authentication method is mainly used to fetch analytics data generated during your AI sessions. Please contact here or your Account Manager to sort out API keys for you. Further, you can also email us at support@unleashlive.com.