kennylerma / facebook-actionscript-api

Automatically exported from code.google.com/p/facebook-actionscript-api
0 stars 0 forks source link

getLoginStatus() not working. #366

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Call Facebook.init()
2. Add JS event listener for callback
3. Call Facebook.getLoginStatus()

What is the expected output? What do you see instead?
Expected to receive a response from Facebook. Instead, nothing is seen.

What version of the product are you using? On what operating system?
GraphAPI_Web_1_8.swc on Windows 7 Professional

Please provide any additional information below.

This the code I used:
<code>
try
{
    // actual facebook event string
    Facebook.addJSEventListener('auth.authResponseChange', OnAuthStatusChange);
    // found in the source code of init(), so I tried this string instead
    Facebook.addJSEventListener('authResponseChange', OnAuthStatusChange);
    // found from docs
    Facebook.addJSEventListener('auth.sessionChange', OnAuthStatusChange);
    // actual facebook event string
    Facebook.addJSEventListener('auth.statusChange', OnAuthStatusChange);
    Facebook.getLoginStatus();
}
catch (e:Error) 
{
    outputTxt.appendText("\n\nERROR GETTING LOGIN STATUS: " + e.message);
}

// variable args so that the callback will not fail as the docs is quite vague 
on the arguments to expect
private function OnAuthStatusChange(... args):void 
{
    outputTxt.appendText("\nOnAuthStatusChange: " + args);
}
</code>

Original issue reported on code.google.com by bluf...@gmail.com on 8 Oct 2011 at 10:46

GoogleCodeExporter commented 9 years ago
oh no!!

Original comment by shotton....@gmail.com on 8 Oct 2011 at 10:22

Attachments:

GoogleCodeExporter commented 9 years ago
The api relies on the Facebook Javascript SDK to make the getLoginStatus() 
call. However, it doesn't seem like the JS side fires the 
auth.authResponseChange event when FB.getLoginStatus() is called. 
If you make the javscript call yourself, you can pass in an anonymous function 
and that will give you a response
FB.getLoginStatus( function(obj){...do stuff if obj.authResponse is present...} 
)

Original comment by edwar...@gmail.com on 19 Oct 2011 at 8:44

GoogleCodeExporter commented 9 years ago
Well...it is still not working for me. Any updates? 

Original comment by PAleksan...@gmail.com on 10 May 2012 at 10:34

GoogleCodeExporter commented 9 years ago
Edwar is correct. 

But there is a bit more that should be mentioned. For starters you can go into 
FacebookJSBridge.as ( should be in your com.facebook.graph.core directory if 
you downloaded graph api 1.8.1 ). In FacebookJSBridge.as you will find 
getLoginStatus function (this is NOT as3 ... this is javascript!! ). This 
function is called when you call Facebook.getLoginStatus. So here add a 
trace-type command so you can see what is happening here; I use "console.log" 
for firebug to trace out what is happening, like so:
--vvvvv---- FacebookJSBridge.as -------------
getLoginStatus: function( ) 
{ console.log("facebookjsbridge.getLoginStatus,A " ) ;      

FB.getLoginStatus( function( response ) 
{ 
console.log( "facebookjsbridge.getLoginStatus , B : " + response.status );
console.log( "facebookjsbridge.getLoginStatus , C : " + response.authResponse ) 
;

if( response.authResponse ) 
{ FBAS.updateSwfAuthResponse( response.authResponse );
} 
else 
{ FBAS.updateSwfAuthResponse( null );
}
} 
);
},
---------------^^^^^----------------------
This might help you, depending on what your particular problem is.

Original comment by shan...@keleia.com on 26 May 2012 at 10:27