API access is unclear

Hi,

I am developing a REST client that will listen to market data, based on conditions trigger a new order etc, standard stuff.

Setting up seems overly complex.

I have gone through the step “Settings → Generate API key” and have saved my “secret” and “cid” (as generated).

Now when I try issue the curl command ( as outlined here Tradovate API ) , I am replacing the password field with the “secret” from above and the cid as from above, also my tradovate “Google:1234…1234” , username I use to login to tradovate web login.

cmd:> curl -X POST https://demo.tradovateapi.com/v1/auth/accesstokenrequest
-H “Content-Type: application/json”
-H “Accept: application/json”
-d “{
"name": "your credentials here",
"password": "your credentials here",
"appId": "Sample App",
"appVersion": "1.0",
"cid": 8,
"deviceId": "123e4567-e89b-12d3-a456-426614174000",
"sec": "f03741b6-f634-48d6-9308-c8fb871150c2"
}”
It gives me an error;

{“errorText”:“Incorrect username or password. Please try again.”}

Again, all I want to do is have the right credentials so I can do market data subscriptions and place/cancel/modify orders. Spefifically websockets for market data and REST API for Orders etc.

Can somebody please assist. This seems overly vague, should be real simple (do it on binance all the time).

Thanks much and have a nice day.

I am in the EXACT same place. Followed the exact same steps and got the exact same error. @Dylan_Clark were you able to resolve the issue, or did you give up?

Resolved the problem myself thanks to this post:

Once I set the password for the API key and used that instead it worked fine.

Hi,

Yes I got it going. I use CURL C++ lib to get accessToken and marketAccessToken.

If its any help to you, here’s the function;

//C++
size_t WriteCallback(void* contents, size_t size, size_t nmemb, std::string* s) {
s->append(static_cast<char*>(contents), size * nmemb);
std::cout << "Received: " << *s << std::endl;
auto tokens = extractMdAccessToken(*s);
std::cout << "Access Token: " << tokens.first << std::endl<< std::endl
<< "marketAccessToken: " << tokens.second << std::endl << std::endl;

return size * nmemb;
}

void authenticate(const std::string& username, const std::string& password, const std::string& appId, const std::string& appVersion, const std::string& deviceId, const std::string& cid, const std::string& secret)
{
CURL* curl = curl_easy_init();
if (curl)
{
curl_easy_setopt(curl, CURLOPT_URL, “https://demo.tradovateapi.com/v1/auth/accesstokenrequest”);

  // Create the JSON payload with the authentication credentials
  json auth_data = {
     {"name", username},
     {"password", password},
     {"appId", appId},
     {"appVersion", appVersion},
     {"deviceId", deviceId},
     {"cid", std::stoi(cid)},
     {"sec", secret}
  };

  std::string json_data = auth_data.dump();

  curl_easy_setopt(curl, CURLOPT_POSTFIELDS, json_data.c_str());

  struct curl_slist* headers = NULL;
  headers = curl_slist_append(headers, "Content-Type: application/json");
  headers = curl_slist_append(headers, "Accept: application/json");
  curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);

  std::string response_string;
  curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, WriteCallback);
  curl_easy_setopt(curl, CURLOPT_WRITEDATA, &response_string);

  CURLcode res = curl_easy_perform(curl);
  if (res != CURLE_OK) {
     std::cerr << "curl_easy_perform() failed: " << curl_easy_strerror(res) << std::endl;
  } else {
     auto json_response = json::parse(response_string);
     accessToken = json_response["accessToken"];
     std::cout << "Access Token: " << accessToken << std::endl;
  }

  curl_easy_cleanup(curl);
  curl_slist_free_all(headers);

}
};