Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to authorize Facebook app using redirect in canvas?
    primarykey
    data
    text
    <p>I'm trying to get into making Facebook apps but I'm having trouble getting authorization working in a redirect scheme inside the canvas.</p> <p>Using the javascript api, I got it working pretty easily in a popup scheme:</p> <pre><code>$("#loginButton").click(function(e) { FB.login(function(response) { if (response.perms) { perms(); } }, {perms : 'publish_stream'}); </code></pre> <p>But the popup should be an unnecessary extra click, because every other application I see requests the authorization before even showing you the landing page. Like this:</p> <p><a href="https://i.imgur.com/yBGzL.png" rel="nofollow noreferrer">http://i.imgur.com/yBGzL.png</a></p> <p>I figure they're simply using a redirect scheme. So I spent the entire day trying the different ways I could find:</p> <pre><code>header("Location: https://graph.facebook.com/oauth/authorize?client_id=" . $gAppId . "&amp;redirect_uri=" . urlencode($gUrl) . "&amp;perms=publish_stream"); header("Location: http://www.facebook.com/login.php?v=1.0&amp;api_key=" . $gApiKey . "&amp;next=" . urlencode($gUrl) . "&amp;canvas="); header("Location: http://www.facebook.com/connect/uiserver.php?app_id=" . $gAppId . "&amp;next=" . urlencode($gUrl) . "&amp;return_session=0&amp;fbconnect=0&amp;canvas=1&amp;legacy_return=1&amp;method=permissions.request"); </code></pre> <p>But all of them, instead of showing the authorization request stuff, show a link like this:</p> <p><a href="https://i.imgur.com/bLwPQ.png" rel="nofollow noreferrer">http://i.imgur.com/bLwPQ.png</a></p> <p>Hilariously, if I open the iframe's address in a new tab, I get the authorization request like I wanted. But I want it to display immediately, without an extra click, like every other app.</p> <p>Here's an example of an app that is doing authorization and requesting permissions all in one go, in redirect form, before even displaying the landing page:</p> <p>www.facebook.com/send.fortune.cookies</p> <p>How are they doing it?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload