You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The scopes are important. Which do you have included in your access token? Without sufficient permission, you won't be able to fetch the page access tokens. business_management is necessary.
Further I see you simply fetch the User object. The page access tokens can be found on the /me/accounts endpoint of the user. Check here: https://developers.facebook.com/docs/facebook-login/guides/access-tokens/#pagetokens
Hi,
I need to get the page ID for one of the facebook pages I manage. I would like to use it to get a "page access token". But the result is empty.
String appId = "";
String appSecret = "";
String SUCCESS_URL = "https://localhost/";
String newValue = ""; // Return url from facebook after successful login
String code = newValue.substring(codeOffset + "code=".length());
DefaultFacebookClient facebookClient = new DefaultFacebookClient(Version.LATEST);
AccessToken accessToken = facebookClient.obtainUserAccessToken(appId, appSecret, SUCCESS_URL, code);
AccessToken extendedAccessToken = facebookClient.obtainExtendedAccessToken(appId, appSecret, accessToken.getAccessToken());
String extendedToken = extendedAccessToken.getAccessToken();
FacebookClient facebookClient2 = new DefaultFacebookClient(extendedToken, Version.LATEST);
User user = facebookClient2.fetchObject("me", User.class);
List ids = user.getIdsForPages(); // Is empty
String pageAccessToken = "";
Does anyone know How I can fix this?
Thank you
The text was updated successfully, but these errors were encountered: