问题描述
按照Firebase文档中的建议,我让Firebase在我的应用程序中处理登录到Facebook的信息:
I'm letting Firebase handle login to Facebook in my app, as advised in the Firebase docs:
loginButton.setPermissions("email", "public_profile");
当我调用GraphRequest.newMeRequest()时,我请求的user_link权限如下:
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();
但是当GraphRequest.newMeRequest()完成时,它将返回一个空对象.如果我在权限请求中遗漏了user_link,则不会发生这种情况.
But when GraphRequest.newMeRequest() completes, it returns a null object. This doesn't happen if I leave out user_link in my permissions request.
推荐答案
您不在那里请求权限,而是在请求字段.
You are not requesting permissions there, you are requesting fields.
该字段名为 link
,而不是 user_link
.
您需要使用 loginButton.setPermissions
请求权限,然后使用正确的名称请求该字段.
You need to request the permission with loginButton.setPermissions
, and then request the field by its correct name.
这篇关于当从Facebook请求user_link权限时,GraphRequest.newMeRequest()返回一个空对象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!