Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

238
Views
How to redirect Facebook instant game iframe to my server?

In a Facebook instant game I try to retrieve the player id, photo and signature - and then redirect to my own server which would verify the signature and then display the HTML5 game.

Here is the Javascript part of my index.html, which I upload as Facebook instant game bundle:

<script src="//connect.facebook.net/en_US/fbinstant.7.0.js"></script>
<script>
window.onload = function() {
    FBInstant.initializeAsync().then(function() {
        FBInstant.startGameAsync().then(onStart);
    });
};

function onStart() {
    FBInstant.player.getSignedPlayerInfoAsync('my_metadata')
    .then(function (result) {
        var lang  = 'en';
        var photo = FBInstant.player.getPhoto();
        var sig   = result.getSignature();
        location.href = 
                'https://wordsbyfarber.com/' + lang + 
                '/facebook?sig=' + encodeURIComponent(sig) +
                '&photo=' + encodeURIComponent(photo)
                ;
    }).catch(ex => {
        console.log(ex);
    });
}
</script>

Then in the Settings / Advanced / Share Redirect Domain Allow List I add the domain of my game backend server:

screenshot settings

However, this does not help - when the instant game is run, then in the console I see the error:

Refused to frame 'https://wordsbyfarber.com/' because it violates the following Content Security Policy directive: "frame-src *.doubleclick.net *.google.com *.facebook.com www.googleadservices.com *.fbsbx.com fbsbx.com data: www.instagram.com *.fbcdn.net https://paywithmybank.com".

And the iframe content served by my backend server is not displayed in the browser:

screenshot fail

I understand, that Facebook is serving a Content Security Policy HTTP header not allowing my game backend server...

Is my setup possible for instant games? Have I overlooked some setting?

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!