Update with media could not authenticate with OAuth


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?



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.


Hi Taylor,

this is how the base string looks like:

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

Thanks again for your help.


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