I’m having a problem with a user logging in:
1) click facebook login button
2) user fills in information on facebook site
3) user is redirected to my site
4) this code is then run:
if ($user)
{
try
{
// Proceed knowing you have a logged in user who's authenticated.
$user_profile = $facebook->api('/me');
$fb_user_id = $user_profile['id'];
...
The api call fires an error:
OAuthException: An active access token must be used to query information about the current user.
5)the user is treated as if they never logged in.
6)manually refreshing the page causes the session to be recognized and the api call does not throw an error.
What is going on? do I need to put a delay in?
I was using the FB JS library incorrectly.
EDIT :
I don’t remember the specifics, but I’ll try my best
I’m using the php SDK to see if a user is logged in through facebook, and if it is, save a session and store cookies. The JavaScript SDK is being used to log in a user through facebook then callback to a login page to update my server and store session variables. From what I can remember something was called out of order giving me a getuser problem. After re-reading the example files given with the sdk, it began to work.