2

Firstly apologies if I get this wrong it's my first post.

I've been building an Android game and I've been trying to integrate Facebook posting into it. Here are the details of tech:

  • Windows 7
  • Developing in FDT
  • Using Flex 4.6 and Adobe Air for Android
  • ActionScript 3.0.

I've plugged in FacebookMobile.init and I pass in both my App's ID and a callback function. However I get the following message returned:

"{"error":{"message":"An active access token must be used to query information about the current user.","type":"OAuthException","code":2500}}"

I noticed on some other pages people have bought this up with no real solution. I have tried the damarmada solution found on another site this didn't work either.

Thanks for your time,

Alan Klement
  • 1,218
  • 7
  • 18

4 Answers4

1

for me its worked. Here is what i did.

1, I added android platform for my app using the "Add Platform" Button in the facebook App settings page.
2, I downloaded the source and used it instead of swc.
3, In facebook App Settings page go to Settings -> Advanced and added http://www.facebook.com/connect/login_success.html into the field "Valid OAuth redirect URIs". And set "Native or desktop app?" to 'Yes'. Now It my app will load the facebook loging page into the StageWebView and there we can login. This is how i login.

var permissions:Array = ["user_about_me","user_friends","publish_actions"];
var stageWeb:StageWebView = new StageWebView ();
stageWeb.stage = stage;// Your app stage
stageWeb.viewPort = new Rectangle (0, 0, stage.stageWidth, stage.stageHeight);
FacebookMobile.login (onLogin, stage, permissions, stageWeb);

Hope this will help you too.

singularity
  • 107
  • 1
  • 13
0

That sounds like your app hasn't logged in, or if you are using SingleSignOn that the Facebook app is not logged in. Login gives you / the Facebook app an access token that you then supply on requests for data.

Torid
  • 4,176
  • 1
  • 28
  • 29
0

UPDATED I believe now that you are putting the FacebookMobile.login() in the wrong spot. Add it to the handler for FacebookMobile.init(), ideally under some kind of else test for if the success object comes back null (which it will when you are not initialized).

You can also still use the below, though the facebook-actionscript-api does seem to work.

To make things simpler for yourself, suggest following the suggestions under the "Windows, OS X and Linux native apps" heading here: https://developers.facebook.com/docs/authentication/

As per the last line of the doc there, use a StageWebView ( http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/media/StageWebView.html ) and listen for the StageWebView locationChange events.

Handle the location redirect uris as you will, but the key thing here is on the default one they give you with the access token (https://www.facebook.com/connect/login_success.html) grab the access token from the url using the StageWebView location property and once it's in your app you can easily create your own URLRequest and use it how you will with your remote services.

Best I've got, please comment if you have a better way.

antman
  • 227
  • 2
  • 17
0

THE SOLUTION !!

private function onAddedToStage(event:Event):void
{
    FacebookMobile.init(_appId, initHandler);
}   
private function initHandler(success:Object,fail:Object):void
{
    if(success)         
{               
    // good the user is already connected           
}           
else            
{
    var myWebView:StageWebView = new StageWebView();
    myWebView.stage = Starling.current.nativeStage;
    myWebView.viewPort = new Rectangle(0,0,stage.stageWidth,stage.stageHeight);
    FacebookMobile.login(loginHandler, Starling.current.nativeStage, PERMISSIONS, myWebView);
    }       
}

from: http://forums.adobe.com/thread/928058

shawndreck
  • 2,039
  • 1
  • 24
  • 30