Question about the Oauth1 base string


#1

Hi all,

I am trying to implement a OAuth1 C++ library. I am stuck at building the OAuth1 base string. I keep getting {“errors”:[{“code”:32,“message”:“could not authenticate you.”}]} error. And I believe the bug is at the base string:

I follow this doc to build the base string: https://developer.twitter.com/en/docs/basics/authentication/guides/creating-a-signature.html

Here is my Base string for posting a Tweet: “123456”

POST&https%3A%2F%2Fapi.twitter.com%2F1.1%2Fstatuses%2Fupdate.json&oauth_consumer_key%3Dxxxxxxxxxxxxxxxxxxxx%26oauth_nonce%3D9DTnZsoNEloppgsU4KV6i8o%26oauth_signature_method%3DHMAC-SHA1%26oauth_timestamp%3D1517334727%26oauth_token%3Dxxxxxxxxxxxxxxxxxxxxxxxxxxxxx%26oauth_version%3D1.0%26status%3D123456

This is my base string for uploading a image named “mac_1024.jpg”

POST&https%3A%2F%2Fupload.twitter.com%2F1.1%2Fmedia%2Fupload.json&oauth_consumer_key%3Dxxxxxxxxxxxxxxxxxxxxxxx%26oauth_nonce%3DTmjr87WC64J_LOHQTH_1lbOLmlI%26oauth_signature_method%3DHMAC-SHA1%26oauth_timestamp%3D1517335007%26oauth_token%3Dxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx%26oauth_version%3D1.0%26media%3Dmac_1024.jpg

I am pretty sure that the hamc-sha1 sign algorithm works fine. I have compared it with python hamc library. So can anyone have a look at the base string I built. Thanks a lot!


#2

Issued fixed by using the exactly same sequence as the doc to build the base string