Facebook Instant Game是否仅支持getSignedPlayerInfoAsync与游戏后端进行通信?

时间:2018-08-07 12:14:07

标签: javascript facebook-instant-games

我需要在Facebook即时游戏中展示广告,我所属的公司希望通过与游戏服务器的通信来获得adID,以参加试镜。通过Facebook链接(https://developers.facebook.com/docs/games/instant-games/guides/bots-and-server-communication#backend),该游戏只能按以下方式运行:

FBInstant.player.getSignedPlayerInfoAsync('custom_payload_supplied_with_request')
  .then(function (result) {
    // The verification of the ID and signature should happen on server side.
    SendToMyServer(
      result.getPlayerID(), // same value as FBInstant.player.getID()
      result.getSignature(),
      ... //any additional parameters required for your server call
    );
   });

1 个答案:

答案 0 :(得分:1)

您可以使用任何基于fetch / XMLHttpRequest的方法来访问Instant Games中的后端系统,但是(根据Facebook的开发人员政策)您不得使用第三方广告网络。受众群体网络是即时游戏唯一受支持的广告网络。

张四光的评论下面有更多详细信息,此处复制以供将来参考:

  1. 网络端必须支持https;
  2. Web端必须支持CORS跨域(html5rocks.com/en/tutorials/cors);
  3. XMLHttpRequest几乎可以遍及每个地方,不受FBInstant.player.getSignedPlayerInfoAsync的限制