Note that there are some explanatory texts on larger screens.

plurals
  1. POCodeIgniter, Facebook and Sessions. Getting lots of oAuth Access Token Errors
    primarykey
    data
    text
    <p>I've been using CodeIgniter for a couple of years. I don't make things too complex, basically, I do this in my controller's constructor:</p> <pre><code>$conf = array ( 'appId' =&gt; 'MY APP ID', 'secret' =&gt; 'MY SECRET KEY'); $facebook = $this-&gt;load-&gt;library('facebook/facebook',$conf); </code></pre> <p>And then, to log the user in, I use the same method on the <a href="https://github.com/facebook/facebook-php-sdk/blob/master/examples/example.php" rel="nofollow">example.php</a> provided by facebook (get user ID, try catch making an API call). <strong>Everything on my controller's constructor</strong>.</p> <p>In the couple of years of using this methodology, everything has worked ok, until now. Last week I coded an app writing basically the same code in every app I've done in the past, the problem is I'm getting A LOT of oAuth Access Token errors, to be precise, I'm getting a message saying that the access token has expired and I need a new one to query the facebook API.</p> <p>So, I know I'm not giving much information about my code, but what I like to discuss is the methodology and not the code itself:</p> <p><strong>How do you handle facebook login in your app?</strong> Do you think the way I'm doing it is OK or I have to do it in a method and not in the constructor? Do I have to save the access token in the database so I can use the same access token when the user come back to the app?</p> <p>It would be great if you have an example with codeigniter.</p> <p><strong>Thank you very much in advance!</strong></p> <p>P.s: I'm autoloading CI sessions library, using the <a href="https://developers.facebook.com/docs/reference/javascript/" rel="nofollow">channel.php file with an expire date of a year</a> and using p3p headers so browsers do accept cookies. I really don't know what I'm missing. P.s2:"I've read a lot of related questions here in stackoverflow, I've tried some advices I've read here, but I get the same result.</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.
 

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