Receiving Response 417 when requesting OAuth Token


#1

I have some code that was working on Friday, and now is not… I get the following response when I try to perform the OAuth ‘threeLegDance’ (I blanked out my key & secret info):

net.oauth.OAuthProblemException: HTTP/1.1 417 Expectation Failed
URL: https://api.twitter.com/oauth/request_token
oauth_signature base string: POST&https%3A%2F%2Fapi.twitter.com%2Foauth%2Frequest_token&oauth_callback%3Dhttp%253A%252F%252Fgreenane%252FX_______.nsf%252Fxsp%252Foauth%26oauth_consumer_key%3DL___________s74A%26oauth_nonce%3D25_________339%26oauth_signature_method%3DHMAC-SHA1%26oauth_timestamp%3D1319469486%26oauth_version%3D1.0

HTTP request:
POST /oauth/request_token
Content-Type: application/x-www-form-urlencoded
Content-Length: 263

oauth_callback=http%3A%2F%2Fgreenane%2FXPagesSBT.nsf%2Fxsp%2Foauth&oauth_signature_method=HMAC-SHA1&oauth_consumer_key=LlJ_______mUs74A&oauth_timestamp=1319469486&oauth_nonce=257_______339&oauth_version=1.0&oauth_signature=EDI%2BJSEhu_________wuI%3D
<<<<<<<< HTTP response:
HTTP/1.1 417 Expectation Failed
Date: Mon, 24 Oct 2011 15:18:03 GMT
Server: hi
Vary: Accept-Encoding
Content-Length: 364
Keep-Alive: timeout=15, max=100
Connection: Keep-Alive
Content-Type: text/html; charset=iso-8859-1

417 Expectation Failed

Expectation Failed

The expectation given in the Expect request-header field could not be met by this server.

The client sent

    Expect: 100-Continue
but we only allow the 100-continue expectation.

It appears from the message that the Expect request header has been changed to expect 100-continue where as the library I am using passes 100-Continue.

The code that is executed looks like the following:
OAuthClient client = new OAuthClient(new HttpClient4());
List parameters = new ArrayList();
parameters.add(new Parameter(OAConstants.OAUTH_CALLBACK, callback));
if(StringUtil.isNotEmpty(signatureMethod)) {
parameters.add(new Parameter(OAConstants.OAUTH_SIGNATURE_METHOD, signatureMethod));
}
client.getRequestToken(accessor, “POST”, parameters);

I am using a library from google to perform the OAuth requests:
http://code.google.com/p/oauth/

This was working OK on Friday, but is not now. Any ideas?


#2

Hm, have you tried modifying the library to pass the lowercase c? The spec says that the comparison should be case-insensitive, but I wouldn’t rule out an error in the server’s implementation. We sometimes change the HTTP server responding to requests, so that may explain your request succeeding on Friday but not today.