• Register
Welcome to Kodlogs, programming questions and answer website.
0 votes

Problem :

I am struggling to find out what is actually happening with my code. My scripts were working fine for some time and suddenly they have half stopped.

I am trying to access my api and I am getting back the access token. With my access token, I can access the users public info just correctly. But, when I want to post any info to their FB account I face below error.

Fatal error: Uncaught OAuthException: An active access token must be used to query information about the current user.

Any idea regarding this what is happening with my code? I am also trying to use sessions on the site to keep track of the internal user ids. Unable to know if my sessions could be causing the problem.

by (7.5k points)  

1 Answer

0 votes

Solution :

I also had the similar issue in the recent past, and it was happening because I was just saving my access token but was not using it. It may be because I had made some silly mistakes because of the due dates pressure, or maybe I just forgot about it! But in any case anyone else is in a same situation:

Now whenever I log in as user I save my access token as below :

$facebook = new Facebook(array(
'myappId' => <insert the app id which you got from facebook here>,
'mysecret' => <insert the app secret which you got from facebook here>
$myaccessToken = $facebook->getAccessToken();
//save your access token for later


by (34.3k points)