Skip to main content

User Authentication

User Authentication

The Hybrik API uses 2 login mechanisms: basic HTTP authentication via OAuth for permitting API access, and a user specific login call, returning an expiring token. This token shall be passed to all API calls in the 'X-Hybrik-Sapiauth' header.

Expiration time for the token is 30 minutes - however, it will be auto-extended (in 30 minute intervals) on successful API calls. After expiration, a new login call, returning a new token, is required.

The credentials for the OAuth authentication are unique per customer account. That authentication does not permit access to any customer resources, it only safe-guards access to the API itself. OAPI credentials can be obtained by the account owner via the Hybrik web interface in the Account > Info page. Only the account owner has access to these credentials.

Alt text

IMPORTANT: For security reasons, the credentials to be used for API access cannot be the same as those of a web interface user account. You must instead use an API User, which can be created in the Hybrik web interface in the Account > API Users page. The Account > Info page also has more information about this, in the bottom right of the page.

Do not share your OAPI credentials or API Authentication credentials with anyone.

Alt text

Login to the Hybrik API. Requires using basic authentication with the API credentials provided by Hybrik

HTTP Request

POST /login

Required Parameters

NameTypeDescription
auth_keystringAPI User name or email address.
Length: 0..512
auth_secretstringAPI User password.
Length: 0..512

curl Example

$ curl -u OAPI_KEY:OAPI_SECRET -X POST https://api-demo.hybrik.com/v1/login \
-d '{
"auth_key": "john.doe@customer.hybrik.com",
"auth_secret": "very secret password"
}' \
-H "Content-Type: application/json" \
-H "X-Hybrik-Compliance: 20220429"

Javascript Example

The example JavaScript code below is based on Node.js and uses the "hybrik_connector.js" module included in the sample code. The hybrik_connector module can be used to create an API access object and submit http-based calls to the Hybrik API. The basic functions are:

Generate an API access object

Connect to the API

Submit an API call

The full sample code can be reviewed and downloaded in the section titled: API Sample JavaScript

Sample Javascript

// Construct an API access object, connect to the API, and then submit a job
var hybrik_api = new HybrikAPI(
api_config.HYBRIK_URL,
api_config.HYBRIK_COMPLIANCE_DATE,
api_config.HYBRIK_OAPI_KEY,
api_config.HYBRIK_OAPI_SECRET,
api_config.HYBRIK_AUTH_KEY,
api_config.HYBRIK_AUTH_SECRET
);

// connect to the API
hybrik_api.connect()
.then(function () {
// submit the job by POSTing the '/jobs' command
return hybrik_api.call_api('POST', '/jobs', null, theJob)
.then(function (response) {
console.log('Job ID: ' + response.id);
return response.id;
})

// error handling and such here