developers studio
developers studio

Reputation: 1

403 error authenticating dxtrade.ftmo.com

I am actually trying to authenticate the dxtrade through the following code. The issue I am facing is getting 403 error, as: 2024.06.20 08:55:44.748 DxTradeBridge (USDCHF,H1) login > Server request failed. Response: 403

so I am actually following the tutorial: https://www.youtube.com/watch?v=Rqqa6CD1NBk&t=420s but I am not able to result the same output the following is the code:

#define Base_URL "https://dxtrade.ftmo.com/dxsca-web/"
#define ACCOUNT_FTMO "1210096366"
#define PASSWORD_FTMO "pass123@P"

int OnInit() {
    login();
    
    return(INIT_SUCCEEDED);
}

int login() {
    string url = Base_URL+"login";
    char post[], result[];
    string headers = "Content-Type: application/json\r\nAccept: application/json\r\n";
    string resultHeader;
    string json = "{\"username\": \"1210096366\", \"domain\": \"default\", \"password\": \"pass123@P\"}";
    StringToCharArray(json,post,0,StringLen(json));

    ResetLastError();
    // int res = WebRequest("POST", url, headers, 5000, post, result, resultHeader);
int res = WebRequest("POST",url,headers,10000,post,result,resultHeader);
    if (res == -1) {
        Print(__FUNCTION__, " > Web request failed. Error code: ", GetLastError());
    } else if (res != 200) {
        string msg = CharArrayToString(result);
        Print(__FUNCTION__, " > Server request failed. Response: ", res);
    } else {
        string msg = CharArrayToString(result);
        Print(__FUNCTION__, " > Request success. Response: ", msg);
    }

    return res;
}

I tried to change the url to https://demo.dx.trade/dxsca-web/login, but it is giving the same error

Upvotes: 0

Views: 213

Answers (1)

Jakub Duch
Jakub Duch

Reputation: 1

I had the same problem. There are some inconsistencies in their documentation. You have to change:

BaseUrl to: "https://dxtrade.ftmo.com/api/auth/",

and in request body instead of domain you will use word "vendor", in your case the value will be "ftmo".

Upvotes: 0

Related Questions