Dpk
Dpk

Reputation: 91

Connecting Bing Ads API using node-soap

I am trying to connect to bing ads soap api using node-soap. I have created the request as suggested in bing documentation. But each time I try to connect the response states the Invalid credentials (Error code - 105) Message - Authentication failed. Either supplied credentials are invalid or the account is inactive.

I was able to authenticate the API using sample C# code provided by bing. So, its clear that the credentials/token are working perfectly fine.

Is there a way to identify the issue with my approach or in my node code.

soap.createClient(url, function (err, client) {
    if (err) {
        console.log("err", err);
    } else {
        client.addSoapHeader({
            'AuthenticationToken': '<AuthenticationToken>',
            'DeveloperToken': '<DeveloperToken>',
            'CustomerId': '<CustomerId>',
            'CustomerAccountId': '<CustomerAccountId>',
        });        
        client.SubmitGenerateReport(args, function (err, result) {
            if (err) {
                console.log("err", err.body);
            } else {
                console.log(result);
            }
        });
    }
});

PS: Bing Documentation Sucks. Hail Stackoverflow!

Upvotes: 4

Views: 1688

Answers (1)

radyz
radyz

Reputation: 1714

You need to prefix each key in your headers with tns, e.g: tns:AuthenticationToken

Upvotes: 5

Related Questions