ccxt: HuobiPro: Signature not valid

  • OS: Mac
  • Programming Language version: PHP 7.1.13
  • CCXT version: 1.10.837
  • Exchange: HuobiPro
  • Method: fetchBalance()

Iam trying to fetch my balance from HuobiPro but i get an error response from HuobiPro everytime i try to access a private method (using my api credentials) - the error response says that the calculated signature is wrong:

{"status":"error","err-code":"api-signature-not-valid","err-msg":"Signature not valid: 校验失败",“data”:null}`

The request in verbose mode looks like that (I replaces my keyId with ###): `Request: Array ( [0] => GET [1] => https://api.huobi.pro/v1/account/accounts?AccessKeyId=###&SignatureMethod=HmacSHA256&SignatureVersion=2&Timestamp=2018-01-25T08%3A13%3A02&Signature=mgOSp3q5NhH6A4kRK%2BMbTcm%2FD2RwR5VAualNUMjrUkk%3D [2] => Array ( [User-Agent] => Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.71 Safari/537.36 )

[3] => 

) `

All public methods from HuobiPro seem to work - only private methods where signature is required do fail. I already deleted and created new api keys to check if that could cause the error - but the signature not valid error persists.

Can anyone check if the signature calculation is wrong - or if it is just an issue on my end?

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 22 (10 by maintainers)

Commits related to this issue

Most upvoted comments

там черт ногу сломит

I created fresh keypairs yesterday - but the error persists.

you are the best, tx bro!

жесть, помогло, ппц, я столько времени убил на эти 5 строчек кода, спасибо!

@izoomrud try double quotes around "\n":

mbp:ccxt igorkroitor$ php -a
Interactive shell

php > echo '\n';
\n
php > echo "\n";

php >

Yes, it works now. Thanks.

Found the problem, I reset the api endpoint upon initialization, this broke the signature:

ccxt.huobipro({‘apiKey’: os.environ[‘HUOBIPRO_API_KEY’], ‘secret’: os.environ[‘HUOBIPRO_API_SECRET’], ‘urls’: {‘api’: ‘https://api.huobipro.com’}})