Expo facebook登录试图获取用户的电子邮件

时间:2017-11-26 01:29:46

标签: javascript facebook reactjs react-native ecmascript-6

我没有收到用户的电子邮件,而是收到“未定义”。我不太清楚为什么,这是代码:

async handleFacebookLogin() {
  const { type, token } = await Expo.Facebook.logInWithReadPermissionsAsync('1993067717635287', {
      permissions: ['public_profile', 'email'],
    });
  if (type === 'success') {
    const response = await fetch(
      `https://graph.facebook.com/me?access_token=${token}`);
    Alert.alert(
      'Logged in!',
      `Hi ${(await response.json()).email}!`
    );
  }
  else
    Alert.alert ('Connection error');
}

0 个答案:

没有答案