react-native-fbsdk 获取 user_birthday 和 user_location 权限不起作用
react-native-fbsdk get user_birthday and user_location permission doesn't work
大家
我将使用 react-native-fbsdk 从 Facebook 获取生日和位置。
这是我的部分代码:
LoginManager.logInWithReadPermissions(['public_profile', 'user_birthday', 'user_location'])
.then((result) => {
if (result.isCancelled) {
return;
}
AccessToken.getCurrentAccessToken().then((data) => {
console.log(data); // output 1:
const responseInfoCallback = (error, profile) => {
if (error) {
console.log(error);
} else {
console.log(profile); // output 2:
}
};
const accessToken = data.accessToken;
const infoRequest = new GraphRequest(
'/me',
{
accessToken,
parameters: {
fields: {
string: 'name,gender,birthday,location{location}',
},
},
},
responseInfoCallback,
);
new GraphRequestManager().addRequest(infoRequest).start();
});
});
})
.catch(error => console.log(error));
Here's result of output 1 and 2
--------- output 1 -------
{ accessToken: .......,
permissions: [ 'email', 'public_profile' ],
declinedPermissions: [],
applicationID: '968214779983507',
accessTokenSource: undefined,
userID: '161823674419561',
expirationTime: 1515417067593.333,
lastRefreshTime: 1510242607593.949 }
-------output 2--------
{ id: '161823674419561', gender: 'male', name: '....' }
请帮助我。
谢谢
这些权限仅适用于在应用程序中具有角色的用户。如果你想让它们为其他人所用,你需要经过一个审查过程:https://developers.facebook.com/docs/facebook-login/review
大家 我将使用 react-native-fbsdk 从 Facebook 获取生日和位置。
这是我的部分代码:
LoginManager.logInWithReadPermissions(['public_profile', 'user_birthday', 'user_location'])
.then((result) => {
if (result.isCancelled) {
return;
}
AccessToken.getCurrentAccessToken().then((data) => {
console.log(data); // output 1:
const responseInfoCallback = (error, profile) => {
if (error) {
console.log(error);
} else {
console.log(profile); // output 2:
}
};
const accessToken = data.accessToken;
const infoRequest = new GraphRequest(
'/me',
{
accessToken,
parameters: {
fields: {
string: 'name,gender,birthday,location{location}',
},
},
},
responseInfoCallback,
);
new GraphRequestManager().addRequest(infoRequest).start();
});
});
})
.catch(error => console.log(error));
Here's result of output 1 and 2
--------- output 1 -------
{ accessToken: .......,
permissions: [ 'email', 'public_profile' ],
declinedPermissions: [],
applicationID: '968214779983507',
accessTokenSource: undefined,
userID: '161823674419561',
expirationTime: 1515417067593.333,
lastRefreshTime: 1510242607593.949 }
-------output 2--------
{ id: '161823674419561', gender: 'male', name: '....' }
请帮助我。 谢谢
这些权限仅适用于在应用程序中具有角色的用户。如果你想让它们为其他人所用,你需要经过一个审查过程:https://developers.facebook.com/docs/facebook-login/review