我要求faceboook拥有user_birthday
和user_likes
的权限。它已获得 facebook 的批准,我已在 facebook 登录react-native
上添加了这些权限
onLogin = async () => {
try {
this.setState({
animating: true,
error: null
});
const result = await LoginManager.logInWithReadPermissions(['public_profile', 'email', 'user_birthday', 'user_likes']);
if (result.isCancelled) {
throw new Error('Please sign in before continue');
}
const tokenData = await AccessToken.getCurrentAccessToken();
const token = tokenData.accessToken.toString();
const credential = firebase.auth.FacebookAuthProvider.credential(token);
const user = await firebase.auth().signInWithCredential(credential);
this.setState({
animating: false,
error: null
});
console.log(user)
this.props.loginSuccess(user);
} catch (error) {
this.setState({
animating: false,
error: error.message
});
}
}
我的问题一切正常(在facebook登录时,facebook说我的应用程序上添加了2个新闻权限以供接受)。但在我的console.log(user)
上,我看不到用户birth_date
和user_likes
我只有providerData
基本信息。
PS:我使用react-native-fbsdk
PS2如果我添加:
alert('Login success with permissions: '
+result.grantedPermissions.toString());
他说:
Login success with permissions: public_profile,user_birthday,email,user_likes