This project has moved and is read-only. For the latest updates, please go here.

Pass callback URL to flickr during token request

Topics: Developer Forum
Aug 20, 2011 at 8:44 PM

I have a scenario where we are hosting several different websites (for different customers) and they are all calling on Flickr to grant permissions for my app to access their Flickr account (for posting, deleting photos and sets).  I'm using standard methods in the Flickr .net library.  All works fine if I have each customer get their own, fixed API key and tokens, but this isn't a scalable approach  I would rather I pass them to Flickr, let them authorize or decline, then return them with the FROB/token in the URL to their site.  Problem is I can only seem to set up one static Callback URL with Flickr at the app level.  I'd rather not use this but instead pass the appropriate Callback URL with the authorization request, but I see no way to do that.  Any clues?

Aug 20, 2011 at 10:27 PM

Two choices.

1) Pass a parameter called "extra" along with the authentication url. This could be your 'real' callback URL. This would require you to have a central callback url for the API key, and then that would forward it to the specific app based on the "extra" parameter.

2) Switch to the OAuth authentication, where the callback URL is specified as a parameter to the authentication methods, and overrides the Flickr setting.

Unfortunately I haven't finished implementing OAuth in the FlickrNet library yet, although it is almost finished.


Aug 21, 2011 at 12:17 AM

Sam:  Thanks.  I've created a common landing page (to use for the static Flickr callback URL setting) and will do a redirect from there using a custom URL I'll build and store in a session variable before sending the user off to Flickr to authenticate.

And thanks for answering my second question (when the FlickrNet library will be modernized for OAuth) before I even asked!

Take care..Thanks, again.

Aug 21, 2011 at 1:35 AM

Sam:  One more you have any sample code to demonstrate passing of the 'extra' parameter?  And are you saying it will be returned, essentially appended to the URL after the FROB, in the response from Flickr?

Aug 21, 2011 at 9:12 AM

Yes, that's exactly what happens.

string url = AuthCalcWebUrl(Perms.Write);

url += "&extra=App1";


and then this will get passed back as Request.QueryString["extra"] along with the frob.


Aug 21, 2011 at 5:33 PM

Thanks, I guess you meant 'extra' quite literally.  I appended it to the request, send the user off to Flickr, they authenticate, but then I get this error (below) thrown on the Flickr side before returning to my callback URL.  Any ideas?

// begin Flickr error message

Oops! The API key or signature is invalid.

An external application has requested your login credentials and permission to perform certain actions on your behalf, but has failed to include all the required data.

You don't really need to know what this means, except that you can't use the application until this problem is fixed. (It's a third-party problem, not a Flickr problem.)

There are lots of applications using the Flickr API. If you are curious about this, visit the Flickr Services page to see more examples of cool stuff. Otherwise, you might like to head to your home page...

// end Flickr error message

Aug 22, 2011 at 2:59 PM

Ah yes, the extra parameter needs to be included in the api_sig calculation - I'd forgotten that.

I've added it to the latest source. In the mean time you could copy that particular method and use it instead.


Aug 22, 2011 at 4:43 PM

Sam:  Thanks.  I was reluctant to part ways with the baked-in methods in the library to get this to work.  I hadn't realized you updated the source code to handle the change to the api-sig.  Thanks for posting that bit...I'll likely snip it and use the method independently...