D
D
DD-var2020-08-07 10:12:47
C++ / C#
DD-var, 2020-08-07 10:12:47

How to log in to YouBit in a C# application?

I'm trying to do it like this:

public string url = "https://yobit.net/tapi/", apiKey= "ключ", sign= "секретный ключ";
private object tapi;
public byte[] art;
public string youbitMoney()
{
    //   byte[] b = new HMACSHA512(null).ComputeHash(Encoding.UTF8.GetBytes(sign));

    //   var key = Encoding.UTF8.GetBytes(sign);
    art = Encoding.UTF8.GetBytes(sign);
         
     HMACSHA512 ds = new HMACSHA512(art);

     var req = new HttpRequest();
     req.AddHeader("Key", apiKey);
     req.AddHeader("Sign", ds.ToString());

     var urlParams = new RequestParams();

     urlParams["nonce"] = "1";

     string send = req.Post(url, urlParams).ToString();

     var money = JObject.Parse(send);
     JToken mk = money["usdt_btc"];

     return send;
}


The server returns a response:
{"success":0,"error":"invalid key, sign, method or nonce"}


What could be the problem?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question