Search…
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
https://api-auth.ianum.com
/v1_3/oauth/token
Create an Access Token
Example Code
Python
PHP
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())
$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);
Copy link