I am facing an issue when trying to access my twitter account metrics
**Signature Base String:** POST&https%3A%2F%2Fdata-api.twitter.com%2Finsights%2Fengagement%2Ftotals&oauth_consumer_key%3D1zjuvbD9jEImvm0okaHzDA%26oauth_nonce%3DNjM2OTE2OTY4MTcwNTA1ODgy%26oauth_signature_method%3DHMAC-SHA1%26oauth_timestamp%3D1556092817%26oauth_token%3DXXXXX-XXXXXXXXXXXXX%26oauth_version%3D1
**OAuth Signature**: S6+Od51vAhS9NkSrkHegNFUZ7Bk=
**Auth Header:** OAuth oauth_consumer_key="1zjuvbD9jEImvm0okaHzDA", oauth_nonce="NjM2OTE2OTY4MTcwNTA1ODgy", auth_signature="S6%2BOd51vAhS9NkSrkHegNFUZ7Bk%3D", oauth_signature_method="HMAC-SHA1", oauth_timestamp="1556092817", oauth_token="XXXX-XXXXXXXXXXXXXXX", oauth_version="1.0"
**{"errors":["Your account could not be authenticated. Reason: Bad signature"]}**
Any help please!
The error message is telling you exactly what is wrong. Check your Oauth signature.
Related - unless you have purchased access to the engagement API, this will not work.
Thanks for your response
I don’t think that the problem is related to my Oauth signature, i tried an another third-party library but still getting same error message, i haven’t purchased access to the engagement API
string parameterString = $"oauth_consumer_key={consumerKey}&oauth_nonce={authNonce}" +
$"&oauth_signature_method={signatureMethod}&oauth_timestamp={timestamp}&oauth_token ={accessToken}&oauth_version=1.0";
string signature = $"POST&{Uri.EscapeDataString(url)}&{Uri.EscapeDataString(parameterString)}";
string authSignature;
using (HMACSHA1 hmac = new HMACSHA1(new ASCIIEncoding().GetBytes($"{Uri.EscapeDataString(consumerSecret)}&{Uri.EscapeDataString(accessTokenSecret)}")))
{
authSignature = Convert.ToBase64String(hmac.ComputeHash(new ASCIIEncoding().GetBytes($"{signature}")));
}
If you have not purchased access then these calls will always fail.
system
Closed
#5
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.