"401 - Not Authorized" - in API v.1.1 -- Need Help!


#1

I have an application that uses v.1 of API to send updates to Twitter without problem. I have been testing the switch to v.1.1 API authentication for the application using the same Twitter account. The authentication headers, etc that it generates look correct to me, but I cannot get past the HTTP error response " The remote server returned an error: (401) Unauthorized". I am following instructions in Twitter’s OAuth documentation for “Authorizing a Request”, “Creating a Signature”, and “Percent encoding parameters” instructions online. But the result is still the same: 401 error.

Below is the information my application generates to send an update to my Twitter account (according to the documents mentioned above). The tokens and consumer secrets have been replaced with “X”. I’d appreciate help from anyone that sees anything incorrect or questionable with the content or structure/length. Any recommendations of what else to try in my testing would be appreciated as well. Many Thanks.

Parameter String:

include_entities=true&oauth_consumer_key=XXXXXXXXXXXXXXXXXXXXX&oauth_nonce=YjZ0fAjmzdMoUfoeC6MM1nSDIvEBIbMxZGcT69z7kDU0&oauth_signature_method=HMAC-SHA1&oauth_timestamp=1362058655&oauth_token=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX&oauth_version=1.0&status=This%20is%20only%20a%20test.%20No%20action%20required%20at%20this%20time.%20This%20is%20a%20test.

Signature String:
POST&https%3A%2F%2Fapi.twitter.com%2F1.1%2Fstatuses%2Fupdate.json&include_entities%3Dtrue%26oauth_consumer_key%3DXXXXXXXXXXXXXXXXXXXXX%26oauth_nonce%3DYjZ0fAjmzdMoUfoeC6MM1nSDIvEBIbMxZGcT69z7kDU0%26oauth_signature_method%3DHMAC-SHA1%26oauth_timestamp%3D1362058655%26oauth_token%3DXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX%26oauth_version%3D1.0%26status%3DThis%2520is%2520only%2520a%2520test.%2520No%2520action%2520required%2520at%2520this%2520time.%2520This%2520is%2520a%2520test.



Signing key:    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX&XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Signature:    0HHEcJTqxLuH+iuf4EuczGoP1sw=

Authorization header :    OAuth oauth_consumer_key="XXXXXXXXXXXXXXXXXXXXX", oauth_nonce="YjZ0fAjmzdMoUfoeC6MM1nSDIvEBIbMxZGcT69z7kDU0", oauth_signature="lQSmkWJfrRCOoI11HwRI1iIRPcg%3D", oauth_signature_method="HMAC-SHA1", oauth_timestamp="1362058655", oauth_token="XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", oauth_version="1.0"

#2

Since there has not been a comment added to my issue here, let me pose the question differently.

My application using the API v1 can produce the expected values for OAuth authorization as documented in the Twitter documents at:
https://dev.twitter.com/docs/auth/authorizing-request
https://dev.twitter.com/docs/auth/creating-signature
https://dev.twitter.com/docs/auth/percent-encoding-parameters

When I change the example URL to “https://api.twitter.com/1.1/statuses/update.json” for v.1.1 and use my own account’s consumer tokens, access tokens, nonce, and timestamp, Twitter alsways returns “401 - Not Authorized”.

Is the information in the three documents incomplete or simply not accurate for v1.1 ? If so, what documents describe the v1.1. authentication process?

Thank you for any help with this issue?


#3

What language are you using to do this?
if it is C# go here and this code will work great for you.
http://www.codeproject.com/Articles/247336/Twitter-OAuth-authentication-using-Net


#4

Correct assumption, it is C#, .NET code. Thank you very, very much for the link. I basically needed to include the following statement and the code works.

        "ServicePointManager.Expect100Continue = false;"

And with two hours to spare before the first v1.0 “Black Out” test.