Skip to main content

Prepare Auth Token

Prepare auth token for use in API Authentication and Authorization

Summary​

using the apicode and apikey on your account from the Management Console as the username and password respectively, prepare a basicAuth token to be used for authentication to the NTRMS API.

Here is an example function in javascript:

src/pages/my-react-page.js
import React from 'react';
import Layout from '@theme/Layout';

const getBasicAuth = (apicode:String, apikey:UUID) => {
const token = apicode + ":" + apikey;
// Base64 Encoding -> btoa
const hash = btoa(token);

const rtn = "Basic " + hash;

return rtn;
}

Done!