OAuth 2.0 Authentication

OAuth 2.0 is an open standard for authorization. With Ianum® Auth, for example, you are required to use API keys, that will be used to authenticate. The credentials should be kept confidential and only use when authorized between application and Ianum® Platform authorization server.

Remember the Oauth token expires in 1 hour.

post
Create an Access Token

https://api-auth.ianum.com/v1_3/oauth/token
Exchange your keys to get an OAuth token.
Request
Response
Request
Body Parameters
grant_type
required
string
The only one supported is "client_credentials"
client_secret
required
string
Secret key created on you Gate Edit console
client_id
required
string
Gate's id received after you create your gate
Response
200: OK
{
"access_token": "EAWkU7g...Md5lTEuj",
"token_type": "Baerer",
"expires_in": 3600
}

Example Code

Python
PHP
Python

You need to install the requests package using this command:

pip install requests==2.20.0
from requests import post, Response
url = 'https://api-auth.ianum.com/v1_3/oauth/token'
headers = {
'Accept': 'application/json',
'Content-Type': 'application/json'
}
body = {
'client_id': 'gate_xxxxxxxxxxxxx', # also the alias is accepted
'client_secret': 'your-client-secret-key',
'grant_type': 'client_credentials'
}
response = get(url, headers=headers, json=fields)
# print the result of the response
print(response.json())
PHP
$url = 'https://api-auth.ianum.com/v1_3/oauth/token';
$data = array(
'grant_type' => 'client_credentials',
'client_secret' => 'your-client-secret-key',
'client_id' => 'gate_xxxxxxxxxxxxx' //also the alias is accepted
);
$data_string = json_encode($data);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 60);
curl_setopt($ch, CURLOPT_TIMEOUT, 60);
// Set the headers
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
"Content-type: application/json",
"Accept: application/json"
));
$result = curl_exec($ch);
curl_close($ch);
//print the result of the response
print_r($result);