Update with media could not authenticate with OAuth


#1

Hi all,

I’m building a website with a configurator where the visitors can upload an image of their design to twitter. But when I try to upload using update_with_media, i get the 401 error. After reviewing other discussions, including https://dev.twitter.com/discussions/1082, it seems like I have sent the correct header, but still it would not authenticate.

Here is the header that is sent:
Authorization: OAuth realm="/1/statuses/update_with_media.json",oauth_consumer_key=“gUU2FAqMP1Beh1TUX3SQw”,oauth_token=“104764789-Hx7aTHaj1L9EcEqTQhUz9tduuv0u7sTtPXo2gf3Y”,oauth_nonce=“8257e891c0479daf72a0eb26ca543027”,oauth_timestamp=“1340014681”,oauth_signature_method=“HMAC-SHA1”,oauth_version=“1.0”,oauth_signature=“Efg737GqjQGUjZbMAcHEV0N%2BbKw%3D”,

Is there anything else I should check?

thanks


#2

I would review that you’re connecting to the right host for this method (upload.twitter.com) and that the signature base string you’re building is accounting for that – additionally, make sure that the OAuth signature base string is also considering your input parameters correctly – when you’re doing multi-part POST like this, only oauth_* parameters make their way into the base string. Finally, make sure that your multi-part POST is well formed as well.


#3

Hi Taylor,

this is how the base string looks like:
POST&http%3A%2F%2Fupload.twitter.com%2F1%2Fstatuses%2Fupdate_with_media.json&oauth_consumer_key%3DgUU2FAqMP1Beh1TUX3SQw%26oauth_nonce%3D6514a619bdc1d2927b6aa208d7c36d1a%26oauth_signature_method%3DHMAC-SHA1%26oauth_timestamp%3D1340073039%26oauth_token%3D104764789-Hx7aTHaj1L9EcEqTQhUz9tduuv0u7sTtPXo2gf3Y%26oauth_version%3D1.0

The multi-part POST can can also break the authentication process?

Thanks again for your help.


#4

Thanks, Thanks a lot MTSpoon, your trick worked 4 me… :slight_smile:


#5

cheers