I am getting this error message while trying to open the facebook page of the user.The strange thing is that if I have a mutual friend with that user the page loads with no problem, but I don’t think it’s default behavior, otherwise I can’t understand the meaning of user_link
permission.
Facebook has approved user_link
permission and I passed App Review.
From developer account I changed the API version the app calls to v3.1
.
The way I am getting user_link
LoginManager.getInstance().logInWithReadPermissions(this, Arrays.asList("user_gender", "user_link"));
LoginManager.getInstance().registerCallback(callbackManager,
new FacebookCallback<LoginResult>() {
@Override
public void onSuccess(LoginResult loginResult) {
makeGraphRequest(loginResult.getAccessToken());
}
@Override
public void onCancel() {
}
@Override
public void onError(FacebookException error) {
}
});
public void makeGraphRequest(AccessToken token) {
GraphRequest request = GraphRequest.newMeRequest(
token, (object, response) -> {
try {
userStorage.setUserProfileUrl(object.getString(AppConstants.LINK));
} catch (JSONException e) {
e.printStackTrace();
}
});
Bundle parameters = new Bundle();
parameters.putString("fields", "name,gender,link,picture.width(700).height(700)");
request.setParameters(parameters);
request.executeAsync();
}
And using this answer for opening the page.
Intent intent;
try {
context.getPackageManager().getPackageInfo("com.facebook.katana", 0);
intent = new Intent(Intent.ACTION_VIEW, Uri.parse("fb://facewebmodal/f?href=" + currentUser.getLink()));
context.startActivity(intent);
} catch (Exception e) {
intent = new Intent(context, FacebookWebViewActivity.class);
intent.putExtra(AppConstants.USER_LINK, currentUser.getLink());
context.startActivity(intent);
}
build.gradle
implementation 'com.facebook.android:facebook-login:4.33.0'
I will be very thankful if someone can suggest any solution. I faced this issue before the facebook new API version also.
2
Answers
From this post we can find the following bit of text
So, I guess there is no way to be 100% sure that the user page will be loaded properly.
https://developers.facebook.com/docs/graph-api/changelog/version3.0#login
As you can read in the changelog, the “link” and “gender” fields are deprecated.
Edit: But they have introduced new permissions
user_link
anduser_gender
so that users can explicitly asked for those particular fields. (Thanks to CBroe for pointing that out)