I can't connect fb with GraphAPI_Source_1_8_1.
this's is my code:
protected static const APP_ID :String = "XXXXXXXXXX";
protected function init(event:FlexEvent):void
{
// TODO Auto-generated method stub
Facebook.addJSEventListener("auth.login", authLoginHandler);
Facebook.init(APP_ID,callBack);
}
protected function authLoginHandler(result:Object):void
{
//if(result && result.session)
//loginHandler(result.session, null);
}
public function callBack(response:Object, fail:Object):void
{
//Callback of the init Function if the user is logged in and he already alowed the app fail will be null
// and response will contain some information like the acessToken
if(response != null)
{
// we don't need to login you can get user information like Facebook.api("/me", getMeHandler); see getUserInfo function
Facebook.api("/me", getMeHandler);
connect.visible = false;
getUserInfo();
}
else
{
connect.addEventListener(MouseEvent.CLICK, onClick);
}
}
public function onClick(e:MouseEvent):void
{
Facebook.login(loginCallBack,{scope:"stream_publish, email"});//
https://developers.facebook.com/docs/reference/api/permissions/ //for more info about permission
}
public function loginCallBack(result:Object, fail:Object):void
{
if(result != null)
{
getUserInfo();
}
}
public function getUserInfo():void
{
Facebook.api("/me", getMeHandler);
}
public function getMeHandler(me:Object, fail:Object):void
{
//
me.name //me.first_name
//me.email etc.......
}