So after playing with Twitter OAuth, I played with Yahoo!’s and now Facebook. So seems like OAuth is the new cool kid in town.
Using the OAuth AS3 library
Also, the oauth-as3 library is relying on the class mx.utils.UIDUtil to generate a unique identifier as a parameter for one of the request. As you can see from the mx prefix, this requires that you compile the Flex framework with your project. Which is kinda a bummer since it is the only dependency to Flex. I found this class on the RGBBlog that provide the same functionality but without requiring Flex. I had to tweak it a bit because it is not really made as a library (it doesn’t have a package and extends Sprite) and I have made it available for download here.
Facebook and OAuth 2.0
So during April 2010, Facebook announced the Open Graph and with it a whole new API but also a new way to authenticate and authorize. It was to use OAuth 2.0, which is a version of OAuth that is still a draft. Well all we learned before (OAuth 1.0) kinda doesn’t work here anymore. But OAuth 2.0 is a bit simpler, supposedly requires less exchanges. This is all cool and all, but Facebook sticks to its guns and provide shitty documentation about the process; well half shitty, they provide good documentation for half of the process but for the other part it is as if the guy was tired of writing documentation and wrapped it up very quickly, leaving us without enough clear information to implement it.
//This makes sure that the crossdomain policy is read and you can access the profile picture Security.loadPolicyFile("http://profile.ak.fbcdn.net/crossdomain.xml");
Also know that if you add that line of code twice, you are going to crash the Flash Player. For this library to work your application in Facebook must absolutely be set as a desktop application.
So that pretty much sums up what I have been doing with OAuth.