lmitchsmith / facebook-actionscript-api

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

Facebook.init returns null callbacks #395

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Use the 1.81 swc
2. Call Facebook.init(APP_ID,handleCallback)
3. See null in both success and fail objects

What is the expected output? What do you see instead?
We are supposed to see a response and/or fail object but in this case we see a 
null in both items. Do we need to set something on the facebook app set up to 
make sure we get some values here?

Thanks in advance

Original issue reported on code.google.com by mtopiwa...@gmail.com on 14 Dec 2011 at 4:42

GoogleCodeExporter commented 8 years ago
I am seeing the same issue and just started seeing it in my app (that has been 
in production for months) today.

Original comment by digitaLo...@gmail.com on 14 Dec 2011 at 7:49

GoogleCodeExporter commented 8 years ago
actually, I was using 1.6.1. I upgraded the swc to 1.8.1 and it works now!

Original comment by digitaLo...@gmail.com on 14 Dec 2011 at 8:09

GoogleCodeExporter commented 8 years ago
Same.. apps that never failed before began failing today a few hours ago.

Have upgraded to latest library to no effect.. what changed?

Original comment by james.la...@gmail.com on 14 Dec 2011 at 10:35

GoogleCodeExporter commented 8 years ago
I am guessing this:

Breaking Change: JavaScript SDK to oauth:true on December 13th
By Jerry Cain - Monday at 17:00
As part of our continued efforts to migrate all apps to OAuth 2.0, we are 
opting in all apps using the new JavaScript SDK to OAuth 2.0 tomorrow at 11am 
Pacific Time. The deadline to support OAuth 2.0 was October 1st, 2011.

The new JS SDK with OAuth 2.0 was introduced in July. Tomorrow, on December 
13th at 11am, we will automatically default the oauth param to true in FB.init. 
With this change, please ensure that you are using FB.getAuthResponse to obtain 
the access token. Read more about the specific changes that you need to make 
here.

Original comment by james.la...@gmail.com on 14 Dec 2011 at 11:51

GoogleCodeExporter commented 8 years ago
I was using 1.6.1 and upgraded to 1.8.1 and don't see a change.
Is there a page where we can find the changes we need to make to support this, 
specifically for action script?

Original comment by scottfri...@gmail.com on 14 Dec 2011 at 2:56

GoogleCodeExporter commented 8 years ago
1.8.1 login ok

Original comment by supp...@hosting-dd.com on 15 Dec 2011 at 2:42

GoogleCodeExporter commented 8 years ago
I have upgraded FB as3 api to 1.8.1. I don't get any callback from 
Facebook.init, all I can see is error in the javascript console:

Uncaught TypeError: Cannot call method 'authResponseChange' of null
FBAS.updateSwfAuthResponse
(anonymous function)
(anonymous function)connect.facebook.net/pl_PL/all.js:11
FB.provide.forEachconnect.facebook.net/pl_PL/all.js:4
FB.provide.fireconnect.facebook.net/pl_PL/all.js:11
cconnect.facebook.net/pl_PL/all.js:23
(anonymous function)connect.facebook.net/pl_PL/all.js:23
FB.provide._xdRecvconnect.facebook.net/pl_PL/all.js:22
(anonymous function)connect.facebook.net/pl_PL/all.js:22
FB.provide.recvconnect.facebook.net/pl_PL/all.js:12
FB.provide.PostMessage.onMessageconnect.facebook.net/pl_PL/all.js:12

Original comment by niepow...@gmail.com on 15 Dec 2011 at 10:25

GoogleCodeExporter commented 8 years ago
EVERYBODY!!!! LISTEN TO ME!!!!!
check your permisiions for the facebook request.
I removed"read_stream" and it came back to life.

//original permission
//var opts:Object = {perms:"publish_stream, user_photos, user_status, 
friends_status,friends_photos, read_stream"};
//new permission
var opts:Object = {scope:"publish_stream, user_photos, user_status, 
friends_status,friends_photos"};
Facebook.login(onLogin, opts);

Original comment by Shai...@gmail.com on 15 Dec 2011 at 2:46

GoogleCodeExporter commented 8 years ago
I have upgraded FB as3 api to 1.8.1. and one application worked perfect. But 
other two don´t working.
Could be some configuration from the options on application as "Encrypted 
Access Token" or "Enhanced Auth Dialog"?

Please help I have my customers desperate :S
Thank you!

Original comment by sguidob...@gmail.com on 15 Dec 2011 at 3:23

GoogleCodeExporter commented 8 years ago
Actually, wth regards to comment #8 where you said you 'removed "read_stream"':

I think that, far more crucially, you changed the 'perms' parameter to 'scope', 
which is part of the update for useing the 1.8.1 API and OAuth 2.0.

Similarly, if you're posting to a user's Wall or photo albums and have this 
kind of object declaration:

var photoParams:Object = {
    image:myBitmap, 
    message:"My uploaded photo",
    fileName:"uploadedPhoto",
    access_token:Facebook.getSession().accessToken
};

...the getSession() method is no longer available in 1.8.1, so you'll have to 
update your access_token value to:

    access_token:Facebook.getAuthResponse().accessToken

Original comment by lawriema...@gmail.com on 15 Dec 2011 at 5:23

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
Hello guys, as per what everyone has been saying, please change your api to 
1.81 which is the latest as OAuth2.0 is forced on everyone now. 
With regards to getting back null values, its said already be dafault that 
there wont be any errors, so that means if u get a double null, you have an 
issue with your calls. 
Now to move forward, what you can test is first is your call being made, in my 
instance it was and it was just not getting back any data. 
If you are having getting the Facebook.init to fire in teh first place set all 
your settings in advanced to disabled except the remove deprecated calls (first 
one)
This should help everyone out. 
Remember check your api key, check your order of calls and make sure your call 
is in a place which can be fired.

Any problems email me mtopiwalla@gmail.com im more than happy to help.

Original comment by mtopiwa...@gmail.com on 16 Dec 2011 at 7:13

GoogleCodeExporter commented 8 years ago
Hello everyone... I am having a very weird problem.
I have two apps... one is working and another is not. I stripped out 
everything... and I have only Facebook.init in one app I am getting the data... 
and in other I am getting both null. I don't know what could be the possible 
reason... anyone who was able to fix the issue of getting both null issue 
please share with us.

thanks

Original comment by saket...@gmail.com on 16 Dec 2011 at 8:04

GoogleCodeExporter commented 8 years ago
I have a real weird problem.
When a user  first enter my application, I can reproduce it clearing all my 
cookies, cache, etc...
Is that conditions Facebook.init callback don't get called, if i refresh the 
page with F5 everything's work fine.
I don't know what else I can do in order to fix it.
Any help?
here is my code

public function Social() 
{
    Facebook.init( Config.FACEBOOK_APP_ID, onInit );
}

// THIS NEVER GET CALLED    
protected function onInit( _result:Object, _fail:Object):void
{                       
    if ( _result )
    {
        Debug.log( "facebook login success" );
        onLogin( );
    }
    else
    {
        Debug.log( "facebook login failed on init, try login" );

        var opts:Object = { scope: "publish_stream" };
        Facebook.login( onLoginEx, opts );
}
}

Thanks

Original comment by key...@gmail.com on 16 Dec 2011 at 11:56

GoogleCodeExporter commented 8 years ago
I found solution to my problem... I hope others did too :)
if not... check it out... I hope my experience will help you.
http://saket.the-confluence.com/2011/12/18/facebook-issue-395/

Original comment by saket...@gmail.com on 17 Dec 2011 at 10:40

GoogleCodeExporter commented 8 years ago
Hello

Same problem here.
I updated my app to the latest library(1.8.1) and the init doesn't work.

I created a new app in Facebook Apps and a new app in my Flash Bulder with 
minimal configuration...

Here is my code:

            public const fbAppId:String = "xxxxxxxxxxxx";

            protected function onInit(event:FlexEvent):void
            {
                Facebook.init(fbAppId, handleInit);
            }

            private function handleInit(result:Object, fail:Object):void
            {
                trace("App Init");
            }

The handleInit function never calls.

Original comment by ad...@radiolynx.ro on 19 Dec 2011 at 7:04

GoogleCodeExporter commented 8 years ago
Hello

Same problem here.

HandleInit never calls!!!

Original comment by pablo.ga...@gmail.com on 19 Dec 2011 at 7:26

GoogleCodeExporter commented 8 years ago
Hello,

I solved the problem... for me :)

<script type="text/javascript" 
src="http://ajax.googleapis.com/ajax/libs/swfobject/2.2/swfobject.js"></script>
<script type="text/javascript" 
src="http://connect.facebook.net/en_US/all.js"></script>    

I added these 2 lines in the head tag of my html where my swf is embeded, and 
this

<div id="fb-root"></div>

to begin of body tag. This div already had it in my html but not those two 
lines.

For me is working great :)

Original comment by ad...@radiolynx.ro on 19 Dec 2011 at 7:42

GoogleCodeExporter commented 8 years ago
After a long struggle I managed to get the callback fired, but the received 
objects are always null...

Original comment by wimreckman@gmail.com on 22 Dec 2011 at 4:13

GoogleCodeExporter commented 8 years ago
Hey everyone,

Don't know if you guys are still having issues, but I was struggling with this 
December 13 Facebook OAuth update for the longest time and finally just got it 
working.

A few things of importance that ended up working for me:

1) Check out this link: 
http://saket.the-confluence.com/2011/12/18/facebook-issue-395/
Helped me a lot!
-In particular, make sure you download the latest API and get rid of the old 
one. 

2) Be sure that you're using scope instead of perms in the Facebook.login
protected function login():void{
     Facebook.login(loginHandler, {scope:"email"});
}

3) I had a FBJSBridge.js file, so in it:
-Make sure to change "response.session" to "response.authResponse". 
-If you have "response.perms" change that to "response.scope". 
-Also change the fb_getSession() function to 

function fb_getAuthResponse() {
    authResponse = FB.getAuthResponse();
    return FB.JSON.stringify(authResponse);
}

-In my fb_init, I also changed "auth.sessionChange" to 
"auth.authResponseChange" as seen below:
function fb_init(opts) {
    FB.init(FB.JSON.parse(opts));

    FB.Event.subscribe('auth.authResponseChange', function(response) {
        updateSwfSession(response.authResponse);
    });
}

4) In the index.htm:

-Make sure the support libraries appear in this order:
<script type="text/javascript" 
src="http://ajax.googleapis.com/ajax/libs/swfobject/2.2/swfobject.js"></script>
<script type="text/javascript" 
src="http://connect.facebook.net/en_US/all.js"></script>

-Facebook init returns null apparently because of how you embed the flash 
player. So make sure it's like this:
swfobject.embedSWF("swfFileName.swf", "flashContent", "760", "800", "10.0", 
null, null, null, {name: "flashContent"})

-I also had a redirect uri, and I had to change the uri from 
'https://graph.facebook.com/oauth/authorize?client_id='+id+'&scope='+perms+'&red
irect_uri='+uri+params; to what you see below:

function redirect(id,scope,uri) {
     var params = window.location.toString().slice(window.location.toString().indexOf('?'));
     top.location = 'https://www.facebook.com/dialog/oauth?client_id='+id+'&redirect_uri='+uri+params+'&scope='+scope;                          }

Hope this helps a bit!

Original comment by cindobi...@gmail.com on 27 Dec 2011 at 5:07

GoogleCodeExporter commented 8 years ago
Hi cindobi, thanks a lot.This help us a lot to solve our problem :) 

_________________________
I added cool smileys to this message... if you don't see them go to: 
http://s.exps.me

Original comment by anitab...@gmail.com on 6 Jan 2012 at 8:28

GoogleCodeExporter commented 8 years ago
Hi cindobi...@gmail.com,

Thanks , It helps us lot.

Original comment by jyoti.s...@gmail.com on 6 Jan 2012 at 8:29

GoogleCodeExporter commented 8 years ago
thanks for everyone who posted suggestions here - helped me fix our broken app 
in no time after pulling my hair out trying to solve it from the official docs 
:)

Original comment by adwo...@finessemanagement.com on 14 Jan 2012 at 12:13

GoogleCodeExporter commented 8 years ago
Hello everybody!

I also have double null issue.
Looking at Facebook.as you can see lines 857-889(handleAuthResponseChange 
function). As I understand from that code - there is NO WAY to get (fail != 
null).

Also, as I see, there is no way to get (authResponse != null) before user press 
"Allow" button at facebook permissions dialog.

So we have two situations: Facebook.init or login will return
1. (null, null), if user doesn't allowed the permissions in dialog
2. (authResponse, null) in other way.

If I am right, may be as3 api team will at least add "fail always null" to docs?

Original comment by Boatin...@gmail.com on 18 Jan 2012 at 8:32

GoogleCodeExporter commented 8 years ago
I had the double null issue too, but just updating the Facebook Graph Api did 
it for me. 

I was getting and storing the accestoken trough the session, but session isn't 
available anymore. You can still get the accestoken via 
"Facebook.getAuthResponse().accessToken".

Original comment by sanderbr...@gmail.com on 31 Jan 2012 at 3:00

GoogleCodeExporter commented 8 years ago
it is not working for me. I tested the sample from 
http://code.google.com/p/facebook-actionscript-api/downloads/detail?name=GraphAP
I_Examples_1_8_1.zip&can=2&q=

the sample is not working as well

Original comment by superma...@gmail.com on 5 Feb 2012 at 7:41

GoogleCodeExporter commented 8 years ago
Did you insert your api key properly? sometimes that is the cause of
problems

Murtuza

Original comment by mtopiwa...@gmail.com on 5 Feb 2012 at 11:30

GoogleCodeExporter commented 8 years ago
API key is same as my app key

Original comment by superma...@gmail.com on 6 Feb 2012 at 5:24

GoogleCodeExporter commented 8 years ago

App ID/API Key
198785700219377

i grab from my facebook page.

Original comment by superma...@gmail.com on 6 Feb 2012 at 5:31

GoogleCodeExporter commented 8 years ago
To make it work you must make sure to pass a name as an attribute when 
embedding the swf
var flashvars = {};
var params = {allowScriptAccess: "always",wmode: "window"};
var attributes = {id:"flashContent",
        name:"flashContent" // Must be included for js to communicate with flash
        };
swfobject.embedSWF("myswf.swf","flashContent", "730", "525", "11.0.0", 
           "expressInstall.swf",flashvars, params, attributes);

Original comment by fjof...@gmail.com on 10 Dec 2012 at 9:48

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
try step 4 on this page, it helped me
http://www.sledjama.com/2013/06/26/facebook-as3-api-facebook-init-and-login-not-
callback-not-called/

Original comment by clinicma...@gmail.com on 26 Jun 2013 at 1:53