Can't get past 401 Unauthorized Twitter streaming API Oauth -


i attempting build c# module connect twitter streaming api using oauth (now option). have got point module access api urls using get, try , make post request fails 401.

i have checked signature correct using oauth tool tab on page twitter app, , fixing values nonce , timestamp in code. have curl windows set , can verify works sample curl script generated oauth tool (by way, needs correction of quotes make work curl in windows cmd. rid of single quotes on values don't need them, use double quotes on needs quoted, , on authorization header, use double quotes , escape double quotes within header backslash).

i have gone length of running curl in trace mode , outputting bytes send in post body c# code , can verify same.

i trying access 'https://stream.twitter.com/1.1/statuses/filter.json' using 'track=twitter' post body. headers are:

accept: */* user-agent: curl/7.21.7(amd64-pc-win32) libcurl/7.21.7 openssl/0.9.8rzlib/1.2.5 content-type: application/x-www-form-urlencoded host: stream.twitter.com content-length: 13 connection: keep-alive authorization: oauth <the oauth stuff> 

i can't inspect packets being sent check on wire requests identical of course ssl encoded.

any ideas?

i got work. things might if have kind of problem discovered:

  1. i had problem because created new nonce every time bit of code accessed. meant nonce used in generating signature key different 1 in header. fail.

  2. i ran above problem. was adding oauth header request after sent request body. reason seems send request write request stream post.

it useful in finding 2. found out how use fiddler trace web requests code. need add web.config:

<system.net>   <defaultproxy>     <proxy  proxyaddress="http://127.0.0.1:8888" />   </defaultproxy> </system.net> 

as tried read https request, fiddler prompted me install bits decrypt request, did , see exact request going down wire. compare curl doing using

-x 127.0.0.1:8888 

option.

however ran problem request timing out. bizarrely enough caused fact fiddler proxying response. once took above out of web.config again worked. halleluja!


Comments