Note that there are some explanatory texts on larger screens.

plurals
  1. POGetting Facebook user from access token (PHP SDK 3.0.1)
    text
    copied!<p>I have an application that utilizes it's own login and facebook login combined. I use my own sessions and cookie to remember the user. I want to remember facebook user but without offline_access, so i figured to set my own cookie for facebook users and when they return just get new access_token from facebook because they have already authorized the app.</p> <p>I managed to do all of that when the user logins for the first time but when they come back and I detect a cookie and I get a valid new access_token I can't put it inside facebook session. I use PHP SDK 3.0.1 and there is a function</p> <blockquote> <p>$this->fb->getUserFromAccessToken($token) </p> </blockquote> <p>inside base_facebook.php but it just throws me a server error when I use it. (fb is my class that extends Facebook class and $token is the valid new token)</p> <p>When I use</p> <blockquote> <p>$this->fb->getUser()</p> </blockquote> <p>it just returns 0.</p> <p>I know that I could get the information from</p> <blockquote> <p><a href="https://graph.facebook.com/me?access_token=" rel="nofollow">https://graph.facebook.com/me?access_token=</a>$access_token</p> </blockquote> <p>but I need to put it somehow inside facebook session</p> <p>Also, there is a function inside base_facebook.php that works for me</p> <blockquote> <p>$this->fb->setAccessToken($access_token);</p> </blockquote> <p>So I can put the token inside the class and it works but when I call getUser() afterwards it still returns 0</p> <p>Any help appreciated Thanks!</p>
 

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