When the user_link permission is requested from Facebook, GraphRequest.newMeRequest() returns a null object

时光怂恿深爱的人放手 提交于 2021-02-11 16:58:45

问题


I'm letting Firebase handle login to Facebook in my app, as advised in the Firebase docs:

        loginButton.setPermissions("email", "public_profile");

When I call GraphRequest.newMeRequest(), I request the user_link permission as follows:

                Bundle parameters = new Bundle();
                // Need special permission from Faceook in order to get this data. Apply after we've settled on a new name for the app.
                parameters.putString("fields", "id, first_name, last_name, email, gender, birthday, timezone, picture, locale, user_link, age_range");
                request.setParameters(parameters);
                request.executeAsync();

But when GraphRequest.newMeRequest() completes, it returns a null object. This doesn't happen if I leave out user_link in my permissions request.


回答1:


When I call GraphRequest.newMeRequest(), I request the user_link permission as follows

You are not requesting permissions there, you are requesting fields.

And the field is named link, not user_link.

You need to request the permission with loginButton.setPermissions, and then request the field by its correct name.



来源:https://stackoverflow.com/questions/60614008/when-the-user-link-permission-is-requested-from-facebook-graphrequest-newmerequ

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!