Authentication
POSThttps://api.domain.com/OAuth/Token
The API uses OAuth2 tokens for access. All tokens are valid for 24 hours. When you need to refresh the token, you must retrieve a new one with the username/password combination.
Request Token
To request a token, send the following information to the endpoint:
| Parameter | Description |
|---|---|
grant_type | Grant type for retrieving a token. We always use "password". |
username | The supplied username. |
password | The supplied password. |
clientId | The supplied client ID. |
clientSecret | The supplied client secret. |
Note: You also need an HTTP header with the supplied api-key.
JavaScript Sample
Below is a sample JavaScript code snippet for requesting a token:
function getToken() {
var loginData = {
grant_type: 'password',
username: $('#txt_username').val(),
password: $('#txt_password').val(),
clientId: 'A34aBS801',
clientSecret: '9e459843-7ee8-4b43-bcaf-4c749b4cf54'
};
$.ajax({
type: 'POST',
url: '/OAuth/Token',
data: loginData,
headers: {
'api-key': 'ADEB998A-6FEF-411B-939F-7F686745905B'
}
})
.done(function (data) {
$('#txt_token').val(data.access_token);
$('#txt_refreshtoken').val(data.refresh_token);
})
.fail(function () {
// handle error
});
}
Postman Information
When you are using Postman to retrieve a token, you need to supply (send) all parameters as x-www-form-urlencoded.