Does Facebook Instant Game only support getSignedPlayerInfoAsync for communication with game backend?

717 Views Asked by At

I need to show ads in the Facebook instant game, the company I belong to hope get adID through communication with game server to meet the audition. From Facebook link (https://developers.facebook.com/docs/games/instant-games/guides/bots-and-server-communication#backend), the game can only work like the following:

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

There are 1 best solutions below

10
On

You can use any fetch/XMLHttpRequest based method of accessing your backend systems in Instant Games, however you may not (according to Facebook's developer policy) use third-party ad networks. Audience Network is the only supported ad network for Instant Games.

Siguang Zhang's comment below has more details, copied here for future reference:

  1. web end must support https;
  2. web end must support CORS to cross domain (html5rocks.com/en/tutorials/cors);
  3. XMLHttpRequest can be requested through nearly every place, not limited by FBInstant.player.getSignedPlayerInfoAsync