I am using a Flex widget for my facebook application. How can I get the current user's facebook ID?
views:
170answers:
1I am using a Flex widget for my facebook application. How can I get the current user's facebook ID?
Create a web application that serves as a proxy between your Flex application and Facebook.
When your webapp is loaded via Facebook, it will be passed a Facebook session ID. Pass this ID to the Flex application and have your Flex application make requests to Facebook via your webapp.
In ActionScript 3 you can access the parameters as attributes of root.loaderInfo.parameters
. You can use whatever protocol you want between the Flex app and the webapp.
An advantage of this is that you can use the sure-to-already-exist Facebook libraries for whatever platform in which you write your webapp.
A disadvantage is that your webapp cannot fully trust the Flex application -- a malicious (or curious) user may try to forge requests from the Flex application to your webapp. In this case you can try to make it as difficult by encoding the traffic between your two applications, but it becomes a matter of Flash bytecode obfuscation.