Flex based Flickr API Authorization control
I just checked in some updates to the ActionScript 3 Flickr library. The biggest change is that I checked in a Flex control that will provide a UI and handle all of the communication to authorize an application with Flickr.
There is no documentation on it, and as I have built it for projects I am using, there are probably some API gaps, but it seems to be pretty solid.
Here is a simple example of how to use it:
import com.adobe.webapis.flickr.authorization.events.AuthorizationEvent;
import com.adobe.webapis.flickr.authorization.AuthorizationView;
import mx.core.IFlexDisplayObject;
import mx.managers.PopUpManager;
//open the authorization panel
private function openAuthorization():void
{
var p:IFlexDisplayObject = PopUpManager.createPopUp(this, AuthorizationView, true);
var auth:AuthorizationView = AuthorizationView(p);
//get this from flickr
auth.flickrAPIKey = "XXXXXXXXXXXXXXXXXXXXX";
//get from flickr
auth.flickrAPISecret = "XXXXXXXXXXXXXXXXXXXX";
auth.isPopUp = false;
p.addEventListener(Event.CLOSE, onAuthorizationClose);
p.addEventListener(AuthorizationEvent.AUTHORIZATION_COMPLETE, onAuthorizationComplete);
PopUpManager.centerPopUp(p);
}
private function onAuthorizationClose(e:Event):void
{
PopUpManager.removePopUp(IFlexDisplayObject(e.target));
}
private function onAuthorizationComplete(e:AuthorizationEvent):void
{
trace(e.authToken);
trace(e.user.username);
}
Basically, this will open a panel that walks the user through the authorization steps (which requires a visit to the Flickr site in the user’s browser). Once the authorization is complete, an event is thrown with the authorization token (which should then be saved between app sessions).
The api requires that your app have an api key and secret key, both of which you can grab from flickr at:
http://www.flickr.com/services/api/keys/apply/
If you run into any issues, or have any suggestions either log a bug on the flickr lib project site, or post a comment here. Plus, if anyone thinks that can make the UI look prettier, just ping me.









Thanks a lot for this Mike.
eric dolecki
12 Aug 08 at 6:24 pm
Hi there,
What i’d like to do is have AS3 access one of my own private photoSets, but I don’t want every user/visitor to my site to have to log in to flickr. Is this (having the user authenticate via a flickr URL) the *only* way to get an auth_token? Or is that unnecessary as I’m accessing my own photoSet?
Thanks in advance!
steve
9 Sep 08 at 5:47 pm
Was starting coding exactly that on top of as3flickr when I encountered your post. You saved me some precious time. Next time I’ll update my SVN before coding ;) I hope to come up with an example showing the usage of the AS3 flickr with ILOG Elixir for MAX.
Christophe
10 Oct 08 at 6:19 am
Well, actually, I updated SVN but the new classes are not compiling :-( Did I miss something?
Christophe
10 Oct 08 at 6:34 am
Ok, got it, bad Flex Builder configuration. Sorry for my previous comment, you can ignore it ;)
Christophe
10 Oct 08 at 6:36 am
Mike, I downloaded the lib from google code, but unless I am missing something there is no com.adobe.webapis.flickr.authorization package in the flickr-.87.zip src folder or available via code completion when dropping the SWC into your project. This post is kind of old… is something similar still available?
Steve Sedlmayr
20 Jun 09 at 2:22 pm