OAuth

Obtain an OAuth access token. The token can be used to authorize API requests as an alternative to Basic Authentication.

In addition, you can use the same API to securely embed views in your own operations dashboards. Please this guide section to learn how to securely embed dashboard views leveraging access token and its scope.

Authentication

HTTP 401 - Unauthorized

{
  "message": "Unauthorized"
}

API requests require Basic Authentication or an OAuth access token to succeed. Failing to set the Authorization header in the right format with correct credentials will result in errors.

A sample Authorization header for Basic Authentication looks like this:

Authorization: Basic V3AxTGdWTjNZSGFmOHVRcE9qalTNTMm5BaEF1RA==

Generating Basic Auth header

credentials="$(echo -n "{AccountId}:{SecretKey}" | base64)"
header="Authorization: Basic $credentials"
const auth =
  "Basic " + new Buffer("{AccountId}" + ":" + "{SecretKey}").toString("base64");
const header = { Authorization: auth };
base64string = base64.encodestring('%s:%s' % ('{AccountId}', '{SecretKey}')).replace('\n', '')
header = ("Authorization: Basic %s" % base64string)
String authString = "Authorization: Basic " +
                Base64.getEncoder().encodeToString(
                        String.format("%s:%s", "{AccountId}","{SecretKey}")
                                .getBytes()
                );
<?php

$header = "Authorization: Basic " . base64_encode('{AccountId}' . ':' . '{SecretKey}');

?>
$header = 'Authorization: Basic ' + Base64.encode64( '{AccountId}' + ':' + '{SecretKey}' ).chomp
let base64encoded = "{AccountId}:{SecretKey}".data(using: .isoLatin1)?.base64EncodedString() ?? ""
urlRequest.addValue("Basic \(base64encoded)", forHTTPHeaderField: "Authorization")

The header should be constructed as follows:

  • The AccountID and SecretKey from your account are combined with a single colon (":")
  • The above sequence, considered a string, is encoded using Base64. You can do this manually here. Please ensure to choose the UTF-8 charset and LF (Unix) as the Newline separator
  • The authorization method and a space ("Basic ") is prepended to the encoded string

A sample Authorization header using an OAuth access token looks like this:

Authorization: Bearer {access_token}

See the OAuth Token API to learn how to obtain an access token.

With authentication in place, you should be able to make successful HTTP requests to HyperTrack APIs.

Language
Click Try It! to start a request and see the response here!