Reputation: 19146
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:
Then I'm asked whether I would like to authenticate this app:
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
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.
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