Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I'm not sure if you've gotten this answered yet, but here's what I found from working through this myself. Even if the user is logged in to facebook, the first time you try to get a session it will be null. The example application I found puts a login button on the form - if you do that, though, then the user will have to click on the button even they're already logged in to facebook. They won't be prompted again, but it's an extra user action.</p> <p>So in my app and in what worked for several others I found in the forums is just to redirect to the login URL. (If you inspect the url, one of its parameters is "return_session=1".) When that comes back, then you'll have a session and can proceed normally.</p> <p>But in my application, if I don't have an application token, then I can't get that session either, so I have to get an application token first. To get an application token, look at the excellent description from <a href="http://forum.developers.facebook.com/viewtopic.php?id=56789" rel="nofollow noreferrer">http://forum.developers.facebook.com/viewtopic.php?id=56789</a>, the post from dynamoman on May 7 2010 (about the fourth post down).</p> <p>One thing I ran into is that regardless of where I tell the authentication is the "next" page, it goes to the page configured in the canvas. So instead of three separate pages, I only have two, and the canvas callback URL has to handle whichever state it's in.</p> <p>My actual code is inside a framework so it's not directly applicable; as an algorithm, it is:</p> <pre><code>landing page: if the facebook api token is not loaded, redirect to the authorization url try to load the user id // to validate that the session if the user id is not loaded, redirect to the loginurl from the facebook api // if it reaches here, then we have both an api token and a session authorization page: get authorization token // see the post for how to do that redirect back to the page configured as the canvas url </code></pre> <p>There may be a better way, and I'm sure someone more familiar with this than myself could have a better solution, or post generic code.</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.
    1. This table or related slice is empty.
    1. VO
      singulars
      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