I am sorry to post almost a duplicate to the question yesterday but after having spent another whole day trying to figure out what my problem is, I would like to ask again, now with a much more detailed question. So basically what I am struggling with, is making POST requests via OAuth 1.0 while GET requests work just fine. I am using an OAuth library which seems to work fine, except – as mentioned above – POST requests.
So let’s take an example POST request:
This is the signature base string my app generates:
POST&https%3A%2F%2Fapi.twitter.com%2F1.1%2Ffriendships%2Fdestroy.json&oauth_consumer_key%3D__consumerKey__%26oauth_nonce%3D2740fc64c%26oauth_signature_method%3DHMAC-SHA1%26oauth_timestamp%3D1369077113%26oauth_token%3D__OAuthToken__%26oauth_version%3D1.0%26user_id%3D__userID__
The authorization header looks like this:
OAuth oauth_timestamp="1369078001", oauth_version="1.0", oauth_consumer_key="__consumerKey__", oauth_token="__OAuthToken__", oauth_signature="yEsbHKIBin69Di24hL3Gb4d5T%2FI%3D", oauth_nonce="18eeacdc1", oauth_signature_method="HMAC-SHA1"
I did not change any of the code of the given library except one thing, which did not improve anything:
I set the Content-Type Header of the request to “application/x-www-form-urlencoded”.
Permission is set to Read/Write/DM and I can access the Direct Messages, so I guess this should not be the problem …
I also reset the keys in my twitter apps console and recreated the tokens. Problem is still there.
No matter what I do, every POST request returns the error “Could not authenticate you” - error code 32.
I really hope somebody can help me, because I have no idea what else could cause the request to fail.
All the best,