Bitcoin Forum

Bitcoin => Project Development => Topic started by: TYDIRocks on August 04, 2015, 08:59:03 PM



Title: Cryptsy API help
Post by: TYDIRocks on August 04, 2015, 08:59:03 PM
Hey guys,

I'm trying to use the Cryptsy API and everything seems to be working except for the methods that require authentication...

Here is my current code: https://gist.github.com/anonymous/8c128bdab19b44eec2f7

Yet everytime I receive this response: {"success":false,"error":["Must be authenticated"]}

Can someone please help me, I cannot for the life of me figure out what I'm doing wrong.


Title: Re: Cryptsy API help
Post by: hexafraction on August 04, 2015, 11:44:05 PM
Please also show the code of generateHMAC, with any private API keys removed/replaced with placeholders.

Edit: I dug up some old code. Here's how I've been doing it:

https://gist.github.com/hexafraction/83ffdf08ed7b44d004b9

In order to construct the parameter 'data', I've been creating a POST parameter string by way of String.format (http://docs.oracle.com/javase/8/docs/api/java/util/Formatter.html):

Code:
String params = String.format("foo=%s&bar=%s&number=%d", valOfFoo, valOfBar, System.currentTimeMillis());

This ensures that the parameters are in the same order as would be expected with HMAC.


Title: Re: Cryptsy API help
Post by: TYDIRocks on August 05, 2015, 02:20:14 AM
I'm not sure if that's correct. This is my hmac function: https://gist.github.com/anonymous/23f2597b19da01f36297

And, for example, this is what it returns: Br7UX6pke+gzxmEP8HUFXzNuIqPJlU+qfqMZiXeJ7N3oZ+fynQZ3g1D12nxNHFZDo0KWZZZ+Qxy4K7+OlUHBFw==

I don't think I need to change it into hexadecimal, I tried using your function and I get the same error.