Hi! I want to import new token with well-known seed, pin and count values
using PI API. But when I try to POST values with php code:
$headr = array();
$headr[] = ‘Content-type: application/json’;
$headr[] = 'Authorization: '.$auth_token;
$post = array(
‘otpkey’ => ‘d6f66965821434f2027e0ea4f597890f7d5c8067’,
‘genkey’ => 0,
‘keysize’ => 20,
‘description’ => ‘Imported’,
‘serial’ => ‘NEW001’,
‘pin’ => ‘1234’,
‘user’ => ‘CN=TEST,OU=Users,DC=corp,DC=org,DC=local’,
‘realm’ => ‘otp.local’,
‘type’ => ‘HOTP’,
‘otplen’ => 6,
‘hashlib’ => ‘sha1’,
);
$ch = curl_init(‘http://otp.local/token/init’);
curl_setopt($ch, CURLOPT_HTTPHEADER,$headr);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, 11);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
I got an error:
string(836) “{“jsonrpc”: “2.0”, “signature”:
“416313853894912787097973931170705837079917015657189350688759404060679104525563606443716509515745966875145268092143786557757425558662438399357315073703514740503664051108933966549092954944961529792489834816779766607887907054329117011924496836058038351099056637398692128751679056146917423520694096970535895835522168052793184069496892254386045030611004433336729095498778382849043271000313278066167225816174572142563929969337187421854605716177180273144414992014532430973258029148566750140593980873630097129070845551607591721914947910794275967911360168737478065973218911333807737691632843124915882344144184815601083599558”,
“detail”: null, “version”: “privacyIDEA 2.10”, “result”: {“status”: false,
“error”: {“message”: “ERR905: Missing parameter: ‘otpkey’”, “code”: 905}},
“time”: 1458307910.744166, “id”: 1}”
So Missing parameter: ‘otpkey’ but it’s present in initial request moreover
I saw it in tcpdump. How I need to pass otpkey to avoid such error?
BR, Vasily.