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:
1
pip install requests==2.20.0
Copied!
1
from requests import post, Response
2
3
url = 'https://api-auth.ianum.com/v1_3/oauth/token'
4
headers = {
5
'Accept': 'application/json',
6
'Content-Type': 'application/json'
7
}
8
body = {
9
'client_id': 'gate_xxxxxxxxxxxxx', # also the alias is accepted
10
'client_secret': 'your-client-secret-key',
11
'grant_type': 'client_credentials'
12
}
13
14
response = get(url, headers=headers, json=fields)
15
# print the result of the response
16
print(response.json())
Copied!
1
$url = 'https://api-auth.ianum.com/v1_3/oauth/token';
2
$data = array(
3
'grant_type' => 'client_credentials',
4
'client_secret' => 'your-client-secret-key',
5
'client_id' => 'gate_xxxxxxxxxxxxx' //also the alias is accepted
6
);
7
$data_string = json_encode($data);
8
9
$ch = curl_init();
10
curl_setopt($ch, CURLOPT_URL, $url);
11
curl_setopt($ch, CURLOPT_POST, 1);
12
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
13
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
14
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 60);
15
curl_setopt($ch, CURLOPT_TIMEOUT, 60);
16
17
// Set the headers
18
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
19
"Content-type: application/json",
20
"Accept: application/json"
21
));
22
23
$result = curl_exec($ch);
24
curl_close($ch);
25
26
//print the result of the response
27
print_r($result);
Copied!
Last modified 1yr ago