Hey,
I hope someone can help me? I am stuck within the same problem.
This is my request:
POST https://api.twitter.com/oauth/request_token
Headers -
Authorization:
oauth_callback: oob
oauth_signature: 4yAvreUerTeHHzIjze9y5zOUHL0%3D
oauth_nonce: g2DUQtXB1tsq93VDG8/1+A==
oauth_version: 1.0
oauth_signature_method: HMAC-SHA1
oauth_consumer_key: mE7K7J1RSFK37HmESCxWXw
oauth_token:
oauth_timestamp: 1363074775
Request parameters -
The server response (including headers):
X-Runtime: 0.01961
X-Transaction: 5d6fe0fcbb98c7a8
Content-Length: 44
Expires: Tue, 31 Mar 1981 05:00:00 GMT
X-MID: 70bf59709152195c551772b7b46f81fcbfc41c81
Last-Modified: Tue, 12 Mar 2013 07:53:00 GMT
Set-Cookie: guest_id=v1%3A136307478028373239; Domain=.twitter.com; Path=/; Expires=Thu, 12-Mar-2015 07:53:00 UTC
Server: tfe
Cache-Control: no-cache, no-store, must-revalidate, pre-check=0, post-check=0
Pragma: no-cache
Status: 401 Unauthorized
X-Frame-Options: SAMEORIGIN
Vary: Accept-Encoding
Date: Tue, 12 Mar 2013 07:53:00 GMT
Content-Type: text/html; charset=utf-8
Protocol version: 1.1
Status line: 401 Unauthorized
Response:
Failed to validate oauth signature and token
I checked my timestamp; it is in GMT and around 5 seconds smaller than the timestamp generated by the server (including connection latency). I’m living in germany, but submitting a GMT timestamp is correct, isn’t it?
I checked the implementation of my key & signature algorithm by Twitter’s tutorial and the examples given @ http://hueniverse.com/oauth/guide/authentication/ . It seems to work correctly…
I did not include a token at the end, but I was appending an “&”.
This is what my unencrypted signature looks like:
POST&https%3A%2F%2Fapi.twitter.com%2Foauth%2Frequest_token&oauth_callback%3Doob%26oauth_consumer_key%3DmE7K7J1RSFK37HmESCxWXw%26oauth_nonce%3Dg2DUQtXB1tsq93VDG8%252F1%252BA%253D%253D%26oauth_signature_method%3DHMAC-SHA1%26oauth_timestamp%3D1363074775%26oauth_token%3D%26oauth_version%3D1.0
My signature:
4yAvreUerTeHHzIjze9y5zOUHL0%3D
I am developing in Java without former twitter/oauth libraries (not applicable for my situation). I would love to see a working signature example in Java… I could also provide the application keys & secrets (that will be resetted after that, of course) to let you check on my signature algorithm.
One question: Does the key have to be URLEncoded (percentage encoded) before using it to encrypt the signature?
You may find my javacode to generate the signature over here: http://paste.ubuntu.com/5607153/
(EncodeUtil.encodePercentage works, that’s for sure; EncryptionUtil.encryptHmacSHA1 works, too, I checked that with sample data and got the correct output)
Best greetings,
Martin Bories