• Register
1 vote
214 views

Problem :

Currently I am struggling to find out what is actually happening with my code. My all scripts were working really fine previously but now they are suddenly half stopped.

I am trying to access the api but I am getting back the access token. With this access token, I am able to access the users public info just fine. But when I want to post info to their Face Book account I am facing below error :

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

6 5 3
7,540 points

Please log in or register to answer this question.

1 Answer

0 votes

Solution :

I had faced the similar issue and it was because I was trying to save the access token but I was not using it. It could be because I just did not think about it in the past. But in case anyone else is in the same situation to fix that follow below procedure :

When I log in the user account for which I have saved the access token:

$facebook = new Facebook(array(

  'appId' => <insert your app id you get from facebook here>,

  'secret' => <insert your app secret you get from facebook here>

));

$accessToken = $facebook->getAccessToken();

//save this access token for later

Now when I try to make the requests to the facebook I just do something like below:

$facebook = new Facebook(array(

'appId' => <insert your app id you get from facebook here>,

'secret' => <insert your app secret you get from facebook here>

));

$facebook->setAccessToken($accessToken);

$facebook->api(... insert your code here ...)

9 7 4
38,600 points

Related questions

0 votes
1 answer 220 views
220 views
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 ... 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.
asked Jan 10, 2020 alecxe 7.5k points
1 vote
1 answer 86 views
86 views
Problem : I am very new to Facebook programming. Currently I want to run a very simple code for Facebook connect which I have already written but now a days I often face below error message : [error] => Array             (                 [message] => An active ... I want expert help here to fix above error as I have already wasted couple of days in debugging above error but no successes yet.
asked Apr 8, 2020 morrisBson 3.2k points
0 votes
1 answer 4 views
4 views
Problem: Please help me &hellip; how can I solve it? How to find facebook friends on spotify?
asked Mar 19 Ifra 24.4k points
0 votes
1 answer 2 views
2 views
Problem Does their API allow my Facebook-connected user to add a friend? I wonder if someone could help me to
asked 2 days ago neeraj 9.5k points
0 votes
1 answer 3 views
3 views
Problem: Hey i am having this invalid session .. please help me to solve it .. invalid requester (person or application), possible invalid/expired session
asked Apr 1 Ifra 24.4k points
0 votes
1 answer 3 views
3 views
Problem: As I mentioned in my previous query, I'm having difficulties with my learning; I've tried searching the web but haven't been able to find adequate information; could you assist me in continuing my project?
asked Apr 1 rakib1 51.5k points
0 votes
1 answer 159 views
159 views
Problem: I am new to Geocoding. I want to program the geocoding. I have already created the API key but if I add it into my current website code then surprisingly I do not get anything and if I do not use the API then somehow everything starts working again. Whenever ... Google Maps Geocoding API is turned on. Kindly tell me if the API key has to be activated also somewhere else to make it work?
asked Jun 17, 2020 Raphael Pacheco 4.9k points
0 votes
1 answer 64 views
64 views
Problem : I am very new to SQL.I and my colleague have recently joined SQL project now I have a table on my SQL Server and I want to export the structure of the table so that I can send it to my colleague. Which SQL command should one fire to get the required table structure? Please note that I don't have any access to the SQL Server Management Studio.
asked Jan 27, 2020 jwilliam 3.9k points
0 votes
1 answer 555 views
555 views
PROBLEM : Please help me on > 'build date php version 4.4.4 server api php variables' ?
asked Mar 16 Samiur1 38.4k points
0 votes
1 answer 9 views
9 views
Problem: Hi i have an issue that i unable to prepare route [api/user] for serialization. uses closure.
asked Mar 18 waseem memon 2.4k points