2

Seems this API is broken and/or abandoned because in some days, this API call always fails during a few hours. Today is happening again, but it's taking more time than previous times.

I don't know what to do. I have 2 Air apps and they aren't working today. Any solution on this?

Here is a simple piece of code:

FacebookMobile.init(APP_ID, onInit);

private function onInit(fbSession:Object, fail:Object):void 
{
    if (fbSession){
        trace(fbSession.accessToken);
    }
    else{
        traceV2(fail); // it's a "deep" trace
        // other API methods related to login
    }
}

In FacebookMobile.init(), we have to expect for an session object (containing FB acess token), or a "fail" object.
The fail object is returning this to me:

[Object]
|   [error:Object]
    | code = 190 
    | message = Malformed access token AAAEWSUA8XjUBAJo4JuO5hUMwSnKC95LNRr1nHHIU8rwPGzxvHIuhUcDziZA9ZC3xDf4ZBwYcqjVU1ir5wf5jlEsJ5zwyMhnnWGyWxXeKQZDZD,AAAEWSUA8XjUBAJo4JuO5hUMwSnKC95LNRr1nHHIU8rwPGzxvHIuhUcDziZA9ZC3xDf4ZBwYcqjVU1ir5wf5jlEsJ5zwyMhnnWGyWxXeKQZDZD 
    | type = OAuthException

Thanks in advance!


Problem fixed. The solution to this specific problem is at at com.facebook.graph.FacebookMobile:560, inside the handleLogin() function.

    protected function handleLogin(result:Object, fail:Object):void {
        loginWindow.loginCallback = null;

        if (fail) {
            loginCallback(null, fail);
            return;
        }

        // ---------------||--------------------//
        // ---------------\/--------------------//
        // This line below solves this problem
        result.access_token = String(result.access_token).split(',')[0];
        // ---------------/\-------------------//
        // ---------------||-------------------//


        session = new FacebookSession();
        session.accessToken = result.access_token;
        session.expireDate = (result.expires_in == 0) ? null : FacebookDataUtils.stringToDate(result.expires_in) ;

        if (_manageSession) {
            var so:SharedObject = SharedObject.getLocal(SO_NAME);
            so.data.accessToken = session.accessToken;
            so.data.expireDate = session.expireDate;
            so.flush();
        }

        verifyAccessToken();
    }
Marcelo Assis
  • 5,136
  • 3
  • 33
  • 54

1 Answers1

2

Seems like its a bug with Facebook returning the Access token as an Array: http://developers.facebook.com/bugs/276418065796236?browse=search_5034a345a2cb15e92344737

I would try edit the String that is returned by removing the second access token value in it. (Everything after the comma) and signing that to your local sessions access token variable. It might resolve the issue