HTTP requests to the REST API are protected with OAuth 2.0 (OAuth 2.0 Framework with Bearer Token Usage).
Development / For testing
Send POST request to:
Production
Send POST request to:
Please register at https://atrs.firs.gov.ng/getting-started/ to get credentials for the api.
Request example in Chrome ARC:
[tabs][tab title=”curl”]Request:
$ curl -X POST -d
"client_id=testclient&client_secret=testpass&grant_type=password&username=admin&password=admin123"
https://api-dev.i-fis.com/oauth2/token
"client_id=testclient&client_secret=testpass&grant_type=password&username=admin&password=admin123"
https://api-dev.i-fis.com/oauth2/token
Response:
{"access_token":"7856444b9e5cc5a9d57f75c989ff1b0140ed1340",
"expires_in":86400,
"token_type":"Bearer",
"scope":null,
"refresh_token":"124c82b2c8d72b6aef49f7d0f1b221d27c0c71ca"}
"expires_in":86400,
"token_type":"Bearer",
"scope":null,
"refresh_token":"124c82b2c8d72b6aef49f7d0f1b221d27c0c71ca"}
[/tab][tab title=”JS”]
// environment: React Native
return fetch('https://api-dev.i-fis.com/oauth2/token', {
method: 'POST',
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json',
},
body: JSON.stringify({
grant_type: 'password',
client_id: 'testclient',
client_secret: 'testpass',
username: 'admin',
password: 'admin123',
})
})
.then((response) => response.json())
.then((responseJson) => {
// your code
}
)
.catch((error) => {
console.error(error);
});
return fetch('https://api-dev.i-fis.com/oauth2/token', {
method: 'POST',
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json',
},
body: JSON.stringify({
grant_type: 'password',
client_id: 'testclient',
client_secret: 'testpass',
username: 'admin',
password: 'admin123',
})
})
.then((response) => response.json())
.then((responseJson) => {
// your code
}
)
.catch((error) => {
console.error(error);
});
[/tab][tab title=”PHP”]
<!--?php
$handle = curl_init('https://api-dev.i-fis.com/oauth2/token');
$data = [
'grant_type' =--> 'password',
'client_id' => 'testclient',
'client_secret' => 'testpass',
'username' => 'admin',
'password' => 'admin123'
];
curl_setopt($handle, CURLOPT_POST, true);
curl_setopt($handle, CURLOPT_POSTFIELDS, $data);
$result = curl_exec($handle);
curl_close($handle);
// Dump result
var_dump(json_decode($result, true));
?>
$handle = curl_init('https://api-dev.i-fis.com/oauth2/token');
$data = [
'grant_type' =--> 'password',
'client_id' => 'testclient',
'client_secret' => 'testpass',
'username' => 'admin',
'password' => 'admin123'
];
curl_setopt($handle, CURLOPT_POST, true);
curl_setopt($handle, CURLOPT_POSTFIELDS, $data);
$result = curl_exec($handle);
curl_close($handle);
// Dump result
var_dump(json_decode($result, true));
?>
[/tab][/tabs]
{
“name”: “Bad Request”,
“message”: “The grant type was not specified in the request”,
“code”: 0,
“status”: 400,
“type”: “filsh\\yii2\\oauth2server\\exceptions\\HttpException”
}
Hi Umesh,
you need to set “password” as a grant type.
Hi Support,
Is there any form of IP filtering on the IP?. I’m trying to test the api but it seems my ip is not getting through to the resource.
What is the authentication used for? this seem to be disconnected from the rest of the system.
do you have a work flow of this system?