I've made a call of Client.MakeRequest("/api/v3/account"); to check if I'm authorized to make such a call, but I keep getting an error status 'unauthorized' everytime I make the call.

public static void MakeRequest(string endpoint)
    {
      var client = new RestClient("https://api.binance.com");

      long timestamp = GetTimestamp();

      RestRequest request = new RestRequest(endpoint, Method.GET);

      request.AddHeader("X-MBX-APIKEY", API_KEY);

      request.AddQueryParameter("recvWindow", "5000");
      request.AddQueryParameter("timestamp", timestamp.ToString());

      request.AddQueryParameter("signature", CreateSignature(request.Parameters, API_SECRET));

      RestResponse response = (RestResponse)client.Get(request);
      System.Diagnostics.Debug.WriteLine(response.Content);

    }

    public static string CreateSignature(List<Parameter> parameters, string secret)
    {
      var signature = "";
      if (parameters.Count > 0)
      {
        foreach (var item in parameters)
        {
          if (item.Name != "X-MBX-APIKEY")
            signature += $"{item.Name}={item.Value}&";
        }
        signature = signature.Substring(0, signature.Length - 1);
      }


      byte[] keyBytes = Encoding.UTF8.GetBytes(secret);
      byte[] queryStringBytes = Encoding.UTF8.GetBytes(signature);
      HMACSHA256 hmacsha256 = new HMACSHA256(keyBytes);

      byte[] bytes = hmacsha256.ComputeHash(queryStringBytes);

      return BitConverter.ToString(bytes).Replace("-", "").ToLower();
    }

    private static long GetTimestamp()
    {
      return new DateTimeOffset(DateTime.UtcNow).ToUnixTimeMilliseconds();
    }

I'm sure the signature is correct as I've followed the specifications from: https://binance-docs.github.io/apidocs/spot/en/#public-api-definitions

Other than that i've been debugging for a while and still can't quite figure out the mistake i'm making.


The endpoint is returning an unauthorized error so you're definitely hitting the endpoint. I see in the documentation that the API key can be restricted to specific IP addresses so check if the API key is correct and has no restrictions. If it does, make sure your IP configured to use the API key.