Forum QuickConnect My game unable to login to Facebook today

Discussion and help relating to PlayerIO's QuickConnect feature, including Facebook Connect and Kongregate Connect.

My game unable to login to Facebook today

Postby moosemouse » June 29th, 2011, 4:53 am

I am having a strange error in which my game is unable to log users in to Facebook. This is with both my Facebook Connected swf, using QuickConnect for Facebook, and my Facebook App using Sitebox. The strangest thing is that I have not changed anything on my game. Is anyone else experiencing a problem similar to this? The Facebook Connected swf is getting the following Syntax Error in the playerIO FB api for AS3:

Error: Syntax Error
at Function/<anonymous>()[C:\Users\shawn\Documents\Projects\FlashGames\RacingGame\Flash\Facebook\JSON.as:145]
at Function/<anonymous>()
at Function/<anonymous>()[C:\Users\shawn\Documents\Projects\FlashGames\RacingGame\Flash\Facebook\JSON.as:405]
at JSON$/deserialize()[C:\Users\shawn\Documents\Projects\FlashGames\RacingGame\Flash\Facebook\JSON.as:409]
at Function/<anonymous>()[C:\Users\shawn\Documents\Projects\FlashGames\RacingGame\Flash\Facebook\FB.as:260]
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at flash.net::URLLoader/onComplete()


I know this is probably not enough info for anyone to properly help. But I am really stumped, so all thoughts and suggestions are appreciated.

Thanks,
Shawn
User avatar
moosemouse
Paid Member
 
Posts: 83
Joined: August 11th, 2010, 2:51 pm
Location: New Albany, Ohio USA

Re: My game unable to login to Facebook today

Postby FulaFisken » June 29th, 2011, 9:28 am

We have the same issue. So you are not alone.
Fula Fisken
website blog twitter
Play Game
Astroflux
User avatar
FulaFisken
Paid Member
 
Posts: 139
Joined: March 2nd, 2011, 10:15 am

Re: My game unable to login to Facebook today

Postby FulaFisken » June 29th, 2011, 9:47 am

The JSON string you get from facebook looks like the following:

Code: Select all
"/**/ c({
   "id": "1610642091",
   "name": "Hepp Noname",
   "first_name": "Hepp",
   "last_name": "Noname",
   "link": "http://www.facebook.com/profile.php?id=13123123123",
....
...
..."


The FB api from PlayerIO take care of the initial "c(" in FB.as:

Code: Select all
if( json.length > 2 && json.substring(0,2)=='c(' ){ // JSONP
   json = loader.data.substring(loader.data.indexOf("(")+1,loader.data.lastIndexOf(')'));
}
            
// deserialize json
var obj:* = JSON.deserialize(json);


But since the string doesn't match anymore it will fail.
Code: Select all
New string recieved from FB:
'/**/ c('

Old String recieved from FB:
'c('
Fula Fisken
website blog twitter
Play Game
Astroflux
User avatar
FulaFisken
Paid Member
 
Posts: 139
Joined: March 2nd, 2011, 10:15 am

Re: My game unable to login to Facebook today

Postby FulaFisken » June 29th, 2011, 9:56 am

A quick fix I made. But you should probably not rely on this since the json string most likely will be changed back, or program something that use regex to replace the '.....c(' part.

Replace line 255 in FB.as with this:

Code: Select all
if( json.length > 2 && json.substring(0,7)=='/**/ c(' ){ // JSONP
Fula Fisken
website blog twitter
Play Game
Astroflux
User avatar
FulaFisken
Paid Member
 
Posts: 139
Joined: March 2nd, 2011, 10:15 am

Re: My game unable to login to Facebook today

Postby Benjaminsen » June 29th, 2011, 12:58 pm

Thats annoying, here is an updated Facebook API that should solve it and will be distributed with the next.

http://o.ogmy.com/812fed1a250c8586d52488cfe9fe4495.zip

For those interested I now pre process the returned JSON to remove anything before the c( call, using a RegExp.
Benjaminsen
.IO
 
Posts: 1444
Joined: January 12th, 2010, 11:54 am
Location: Denmark

Re: My game unable to login to Facebook today

Postby moosemouse » June 29th, 2011, 2:57 pm

Thanks for fixing this so quickly, Benjaminsen! I am still getting the syntax error.. occasionally with the new code. But even with the error my game continues and logs in now, so that is good.

Sorry, I am not up on JSON, so I am not much help. But here is the error I am getting now:

Error: Syntax Error
at MethodInfo-345()
at MethodInfo-352()
at MethodInfo-353()
at JSON$/deserialize()
at MethodInfo-121()
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at flash.net::URLLoader/onComplete()
User avatar
moosemouse
Paid Member
 
Posts: 83
Joined: August 11th, 2010, 2:51 pm
Location: New Albany, Ohio USA

Re: My game unable to login to Facebook today

Postby Benjaminsen » June 29th, 2011, 3:02 pm

moosemouse wrote:Thanks for fixing this so quickly, Benjaminsen! I am still getting the syntax error.. occasionally with the new code. But even with the error my game continues and logs in now, so that is good.

Sorry, I am not up on JSON, so I am not much help. But here is the error I am getting now:

Error: Syntax Error
at MethodInfo-345()
at MethodInfo-352()
at MethodInfo-353()
at JSON$/deserialize()
at MethodInfo-121()
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at flash.net::URLLoader/onComplete()


Can get you to add some traces in onComplete that traces the returning data in onComplete? The data returned just before the Syntax Error would be the set I am interested in.
Benjaminsen
.IO
 
Posts: 1444
Joined: January 12th, 2010, 11:54 am
Location: Denmark

Re: My game unable to login to Facebook today

Postby moosemouse » June 29th, 2011, 3:24 pm

I've tracked my error down. I am getting the Facebook third_party_id using this AS3:

Code: Select all
FB.api
(
     '/me?fields=third_party_id&access_token='+accessToken,
     function(response:*):void
     {
          if (response && response.third_party_id)
          {
               trace("response.third_party_id = "+response.third_party_id);
               thirdPartyId = response.third_party_id;
          }
          else
          {
               trace("third party id not received");
          }
     }
);


The deserializing is breaking when it receives this json string (I put x's in place of the real id's): {"third_party_id":"xxxxxxxxxxxxxxx","id":"xxxxxxxxxx"}

And, again, here is the error:
Error: Syntax Error
at Function/<anonymous>()[C:\Users\shawn\Documents\Projects\FlashGames\RacingGame\Flash\Facebook\JSON.as:145]
at Function/<anonymous>()
at Function/<anonymous>()[C:\Users\shawn\Documents\Projects\FlashGames\RacingGame\Flash\Facebook\JSON.as:405]
at JSON$/deserialize()[C:\Users\shawn\Documents\Projects\FlashGames\RacingGame\Flash\Facebook\JSON.as:409]
at Function/<anonymous>()[C:\Users\shawn\Documents\Projects\FlashGames\RacingGame\Flash\Facebook\FB.as:265]
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at flash.net::URLLoader/onComplete()


Edit: And I believe it is only "occasionally" because some of the time the call fails to receive a third_party_id. Don't know why this happens, but that is for another forum topic.
User avatar
moosemouse
Paid Member
 
Posts: 83
Joined: August 11th, 2010, 2:51 pm
Location: New Albany, Ohio USA

Re: My game unable to login to Facebook today

Postby mal_Duffin » April 5th, 2013, 2:08 pm

Is it possible to get this fix updated to the latest online version?

Also, with using FD and the FB methods, I was getting a namespace conflict for JSON. For now, I've just renamed JSON.as as FBJSON.as ( and updated in the relevant places ). Not sure if it's just me, as I'm new to playerio / FB development.
mal_Duffin
Paid Member
 
Posts: 2
Joined: March 25th, 2013, 3:56 pm

Re: My game unable to login to Facebook today

Postby mal_Duffin » April 5th, 2013, 3:15 pm

By the online version, I mean of course https://github.com/playerio/Facebook-Graph-As3

With the 2 changes above that I made ( for the code, I changed it to check for either the original or the new position of the c ), everything is working great!
mal_Duffin
Paid Member
 
Posts: 2
Joined: March 25th, 2013, 3:56 pm

Re: My game unable to login to Facebook today

Postby Benjaminsen » April 5th, 2013, 6:10 pm

mal_Duffin wrote:By the online version, I mean of course https://github.com/playerio/Facebook-Graph-As3

With the 2 changes above that I made ( for the code, I changed it to check for either the original or the new position of the c ), everything is working great!


The code change is made in the download package already. I will see if we can get it pushed to github.
Benjaminsen
.IO
 
Posts: 1444
Joined: January 12th, 2010, 11:54 am
Location: Denmark


Return to QuickConnect