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.
{"access_token": "EAWkU7g...Md5lTEuj","token_type": "Baerer","expires_in": 3600}
Example Code
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 responseprint(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 headerscurl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-type: application/json","Accept: application/json"));ā$result = curl_exec($ch);curl_close($ch);ā//print the result of the responseprint_r($result);