Flutterby™! : Flickr upload with OAuth using C#/

Next unread comment / Catchup all unread comments User Account Info | Logout | XML/Pilot/etc versions | Long version (with comments) | Weblog archives | Site Map | | Browse Topics

Flickr upload with OAuth using C#/

2011-09-29 21:36:09.052979+00 by Dan Lyke 4 comments

Flickr upload with OAuth using C#/.NET and no external libraries: Achievement(?!) unlocked. #learnedthingsIshouldnotneedtoknow

comments in descending chronological order (reverse):

#Comment Re: made: 2011-09-30 22:32:13.645541+00 by: Dan Lyke

Nope, although I did set up parallel writes so I could figure out exactly what was going over the wire. There are some amazingly good docs out there, with logs of the HTTP sessions, and then some huge gaps in the docs. My initial OAuth stuff worked the first time out, and then things got into reading the development threads on various discussion forums...

#Comment Re: made: 2011-09-30 21:55:13.323994+00 by: meuon

Sounds like you sniffed a working session and mimic'd it.

#Comment Re: made: 2011-09-30 14:24:05.874262+00 by: Dan Lyke [edit history]

The GET/POST thing that I'm aware of is that the first element of your OAuth signature has to match the request type. So your signature string looks something like:

POST&http%3A%2F%2Fapi.flickr.com%2Fservices%2Frest&...CGI variables

Rather than

GET&http%3A%2F%2Fwww.flickr.com%2Fservices%2Foauth/request_token&...CGI variables

The other nastiness is that the upload URL requires an Authorize: header, the others don't (but will still succeed if you pass it anyway). This is a header string that looks like:

Authorization: OAuth oauth_consumer_key="blabla", oauth_nonce="blabla", oauth_version="1.0", oauth_signature="blablabla%3D", oauth_token="blabla", oauth_signature_method="HMAC-SHA1", oauth_timestamp="123456789"

An echo of the oauth_... variables that you have to include in your request anyway.

#Comment Re: made: 2011-09-29 23:10:08.607177+00 by: spc476

So I take it you figured out the magic incantations to GET/POST to get that to work. Care to share?