donturner
donturner

Reputation: 19146

"Access Token not found" when using Facebook SDK

I have a BlackBerry app which needs to post a message to a user's Facebook wall. I am using the Facebook BlackBerry SDK.

I have set up a simple test app which attempts to get the current user's details when a button is pressed by calling the following method:

private void postToFacebookWall(){

    String NEXT_URL = "http://www.facebook.com/connect/login_success.html";
    String APPLICATION_ID = "xxx"; //Removed for security
    String APPLICATION_SECRET = "xxx"; //Removed for security
    String[] PERMISSIONS = Facebook.Permissions.USER_DATA_PERMISSIONS;

    ApplicationSettings as = new ApplicationSettings(NEXT_URL, APPLICATION_ID, APPLICATION_SECRET, PERMISSIONS);
    Facebook fb = Facebook.getInstance(as);

    try {

        User user = fb.getCurrentUser();
        Logger.log("User has authenticated app and logged in. Name: "+user.getName());

    } catch (FacebookException e) {

        Logger.log(e.getMessage());
    }

} 

Here's what happens when I click the button.

In the system log I receive an error message: Access Token not found.

Then the following login screen is shown:

enter image description here

Then I'm asked whether I would like to authenticate this app:

enter image description here

Clicking on 'Install' or 'Cancel' does nothing.

If I log into Facebook via the website and authenticate the app then I don't get the 'Access Token not found' error and everything works as expected.

How can I allow my Facebook app to be authenticated correctly to avoid the 'Access Token not found' error?

Upvotes: 1

Views: 2492

Answers (1)

Eugen Martynov
Eugen Martynov

Reputation: 20130

Actually any BB app with same approach can't authorize right now. It is FB issue, but no one is hurry to fix it.

  1. Here is mine question: Unable to pass FB OAuth for my application
  2. Here is FB bug ticket: https://developers.facebook.com/bugs/401534949883394?browse=search_4ffad6fdebcfa6990918340
  3. Here is topic on dev forum: http://supportforums.blackberry.com/t5/Java-Development/FaceBook-API-error-code-11-Method-Deprecated/m-p/1808833#M203977

I found workaround to pass it but it doesn't work for all OSes/devices. Use iPhone user agent "Mozilla/5.0 (iPhone; U; CPU iPhone OS 3_0 like Mac OS X; en-us) AppleWebKit/528.18 (KHTML, like Gecko) Version/4.0 Mobile/7A341 Safari/528.16" and enable cookies in BrowserField.

Please mark FB issue as reproduced. So probably they will increase priority and fix it faster.

UPDATE: FB fixed the issue! Please verify!

Upvotes: 2

Related Questions