views:

413

answers:

3

I've written a twitter client for Win7 desktop gadgets (html + JavaScript). I'm trying to convert over to OAuth but can't even "get off the ground" so to speak. I'm using the twitter suggested JavaScript lib.

Here's the request I'm sending and the 401 response. Can anyone spot the issue. I'm stumped.

GET /oauth/request_token HTTP/1.1
x-requested-with: XMLHttpRequesst
Accept-Language: en-us
Authorization: OAuth realm="http%3A%2F%2Ftwitter.com",oauth_consumer_key="tHupzQvYhbIknowkcQZCBw",oauth_version= "1.0",oauth_timestamp="1262185882",oauth_nonce="xBkBJc",oauth_signature_method="HMAC-SHA1",oauth_signature="Gec%2F%2B7QemcnEUTnkDHAIXI7wA5k%3D"
Accept: text/plain, */*
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET4.0C; .NET4.0E)
Host: twitter.com
Connection: Keep-Alive
Cookie: _twitter_sess=BAh7CDoRdHJhbnNfcHJvbXB0MDoHaWQiJTlmMWZhOTNhM2I3ZTgzOGMxMGZi%250AN2VkZGM2NzgzYzY1IgpmbGFzaElDOidBY3Rpb25Db250cm9sbGVyOjpGbGFz%250AaDo6Rmxhc2hIYXNoewAGOgpAdXNlZHsA--0d82a56e2666db16b4b19c5a7a2e50bedfdacadb


HTTP/1.0 401 Unauthorized
Date: Wed, 30 Dec 2009 15:11:25 GMT
Server: hi
X-Transaction: 1262185885-20125-10018
Status: 401 Unauthorized
Last-Modified: Wed, 30 Dec 2009 15:11:25 GMT 
X-Runtime: 0.01220
Content-Type: text/html; charset=utf-8
Pragma: no-cache
Cache-Control: no-cache, no-store, must-revalidate, pre-check=0, post-check=0
Expires: Tue, 31 Mar 1981 05:00:00 GMT
X-Revision: DEV
Set-Cookie: _twitter_sess=BAh7CDoRdHJhbnNfcHJvbXB0MCIKZmxhc2hJQzonQWN0aW9uQ29udHJvbGxl%250Acjo6Rmxhc2g6OkZsYXNoSGFzaHsABjoKQHVzZWR7ADoHaWQiJTlmMWZhOTNh%250AM2I3ZTgzOGMxMGZiN2VkZGM2NzgzYzY1--b3e8e63eaa02e1ac989f58ee87bacc67b1d72847; domain=.twitter.com; path=/
Vary: Accept-Encoding
Content-Length: 44
Connection: close

Failed to validate oauth signature and token

Any thoughts?

A: 

I'm not sure about this.. but should be sending an oauth token in yout request, are you sending it?

ClaudioA
+1  A: 

And the answer is: I forgot to use the consumerSecret when signing. Sigh...

Mike Ward
+1  A: 

Can you please share the snippet how you are forming this url