以承诺方式调用Facebook API

问题描述 投票:0回答:1

我已安装:npm facebook-login,它可以正常工作(返回Facebook令牌和用户ID),但是它没有与“ api”功能的接口。所以我将其添加到脚本中,但是当我调用它时,它返回一个错误:

enter image description here

fb_login = () =>
{
  log('fb_login')
  api.whenLoaded().then(() =>
  {
    log('loaded!');
    api.login(["email","public_profile"]).then((response) =>
    {
      log('return from facebook');
      log(response);
      api.api('/me').then((response) =>
      {
        log('Good to see you, ' + response.name + '.');
      });
    });
  });
}
javascript promise facebook-javascript-sdk
1个回答
0
投票

此npm不起作用,但是我只是从SDK中实现了FB api,它简单而直接。

© www.soinside.com 2019 - 2024. All rights reserved.