Facebook is currently in the process of deprecating fb_sig
and will be using signed_request
for authentication. This is part of their OAuth 2.0 migration.
Here are some relevant links
http://developers.facebook.com/blog/post/497/
http://developers.facebook.com/docs/authentication/signed_request/
Also the new Adobe actionscript 3 Graph API communicates with Facebook using the OpenGraph API
http://code.google.com/p/facebook-actionscript-api/
Since the facebook Graph API component does not work with CS3 I decided to use another class written by Jozef Chutka
However you may download the Graph API source code and import into your actionscript code.
This post will include show how I migrated my iQuiz application.
Since OAuth 2.0 pertains to application user authorization while connecting or logging in the QuizConnect.as class file had to be edited to allow for the migration. The iFrame HTML and PHP code were also changed.
The class constructor calls the initConnect function which calls subsequent methods
private function initConnect2 () { var fbUser = new FacebookUser (); txt_appStatus = MainQuiz.QStage.txtAppStatus; btnLogin = MainQuiz.QStage.btn_login; btnStartQuiz = MainQuiz.QStage.btn_start; btnStartQuiz.enabled = false; txt_appStatus.text = MainQuiz.QStage.loaderInfo; btnLogin.addEventListener (MouseEvent.CLICK, login); btnLogin.addEventListener (MouseEvent.CLICK, playButton2); var newLoaderInfo:LoaderInfo = MovieClip(MainQuiz.QTimeline).preLoaderInfo; session = new FacebookSessionUtil(API_KEY, null, newLoaderInfo); connect2 = new FacebookConnectUtil(newLoaderInfo); connect2.addEventListener( FacebookEvent.COMPLETE, onConnectHandler2 ); if(session.verifySession ()) { this.facebook = session.facebook; txt_appStatus.text = "verifying session"; } else { session.validateLogin(); this.facebook = session.facebook; txt_appStatus.text = "no verify session"; txt_appStatus.text = String(newLoaderInfo.parameters.fb_sig_canvas_user); txt_appStatus.text = String(session.activeSession); } if(String(session.activeSession) == "[object DesktopSession]"){ this.uid = String (newLoaderInfo.parameters.fb_sig_canvas_user); addQuiz (); } else{ this.uid = String(newLoaderInfo.parameters.fb_sig_user); btnStartQuiz = MainQuiz.QStage.btn_start; btnStartQuiz.enabled = true; addQuiz (); } var flashVars:Object = Object(MovieClip(MainQuiz.QTimeline).paramObj); }
The flashVars parameters were accessed through the LoaderInfo instance – newLoaderInfo. Using Flash’s ExternalInterface class to pass the values from the Javascript.
The facebook session was verified using the Facebook object’s verifySession method.
To publish a post using Graph API
http://developers.facebook.com/docs/reference/api/post/
Leave a Reply