Bitfinex API V2 BUG apikey: ungültiger Code 10100
Posted: 03 Jan 2025, 17:57
Ich habe überall gesucht und leider hat bis heute niemand eine richtige Lösung dafür gefunden. Daher möchte ich diese Frage stellen, um zu bestätigen, ob es sich hierbei um einen FEHLER im API-Authentifizierungssystem von Bitfinex handelt. Ich habe die Codes in PHP geschrieben. Sollten Sie ein Problem in meinem Code finden, können Sie es erwähnen und ich werde es testen, um zu sehen, ob es funktioniert. Ich sollte erwähnen, dass ich viele Situationen getestet habe und immer noch die Fehlermeldung apikey: invalid & code 10100 erhalte. z.B. Kodieren des Geheimnisses und der Nutzlast in UTF-8.
Hinweis: Dieser Ansatz wurde ebenfalls vollständig getestet und hat nicht funktioniert: https://stackoverflow.com /a/46851626/7644018
Hinweis: Dieser Ansatz wurde ebenfalls vollständig getestet und hat nicht funktioniert: https://stackoverflow.com /a/46851626/7644018
Code: Select all
private function nonce(){
return time()*1000; //Also time()*1000*1000 is tested
}
private function signature($api_path,$body,$nonce){
$str = "/api/$api_path" . $nonce . json_encode($body);
return hash_hmac('sha384',$str,$this->secret); //Also UTF-8 encoding $str & secret are tested
}
public function getTradeFee(string $currency) : array{
$api_path = "v2/auth/r/summary";
$request_path = $this->auth_base_url . $api_path;
$body = []; //params are not needed for this path
$nonce = $this->nonce();
$headers = [
"Content-Type: application/json" ,
"bfx-nonce: $nonce" ,
"bfx-apikey: " . $this->key , //Key is double checked and is correct (With full permissions)
"bfx-signature: " . $this->signature($api_path,$body,$nonce)
];
$curl = curl_init($request_path);
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_POSTFIELDS, $body);
curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
$info = curl_exec($curl);
curl_close($curl);
$info = json_decode($info);
return $info;
}