I got below error. Can anyone help me?
Error: This request is not properly authenticated
The generated oauth_signature is working on another endpoint. Ex: same authorization works with this endpoint:
https://ads-api.twitter.com/11/accounts/18***dc/line_items/g***8/?total_budget_amount_local_micro=700000000000
but authorization failed for below endpoint.
https://ads-api.twitter.com/11/accounts/18***50vkdc/line_items/g***8/?end_time=2019-12-01T13:02:00Z
See my working funtion - this is working
authorization failed for lineenddate function -this is not working .
This is what my code:
const request_data = {
url: this.config.get('TWITTER_ADS_API') + '11/accounts/' + adAccountData.accountId + '/line_items/' + data.lineId + '?end_time=' + data.endDate,
method: 'PUT',
};
const token = {
key: adAccountData.authToken,
secret: this.config.get('TWITTER_TOKEN_SECRET'),
};
const axios = require('axios');
const config = {
method: request_data.method,
url: request_data.url,
headers: await oauth.toHeader(oauth.authorize(request_data, token)),
};
const res: any = await axios(config)
.then(function (response) {
// console.log(JSON.stringify(response.data));
return response.data;
})
.catch(function (error) {
Logger.log(error.message);
});
Logger.log(res);
return res;