Skip to main content

Authentication

Basic authentication is a simple authentication scheme built into the HTTP protocol. It requires an Authorization header containing the word Basic followed by a space and a Base64-encoded string in the format clientId:clientSecret. Always use HTTPS to ensure credentials are securely transmitted.

caution
  • Always use HTTPS to protect your credentials during transmission.
  • Ensure that your Client API Key and Client Secret are kept confidential.
  • Base64 encoding is not encryption; it only encodes the data for safe transport.

This ensures secure access to protected resources through the API.

Creating a Secure Request

To authenticate with our API, include the HTTP Authorization header in your requests. The header is constructed as follows:

Authorization: Basic <Base64_Encoded_String>

This approach ensures secure communication between the client and server.

Example Code

const clientId = 'MY_CLIENT_ID';
const clientSecret = 'MY_CLIENT_SECRET';

// Combine Client ID and Client Secret with a colon
const encodedData = Buffer.from(`${clientId}:${clientSecret}`).toString('base64');

// Generate the Authorization header
const authorizationHeaderString = `Authorization: Basic ${encodedData}`;

console.log(authorizationHeaderString);
// Example output: Authorization: Basic <Base64_Encoded_String>