0

It is web base application. The first page is asking for login. Once they click the login button, everything is going on with ajax.

In the ajax request,

 $user = $facebook->getUser(); 

This is giving proper user id.

 if ($user) {
    try {
        $fbme = $facebook->api('/me');
        $user_id = $fbme['id'];
    } 
    catch (FacebookApiException $e) {           
         error_log($e);
         $user = null;
    }
}

The below line was working before. Now it is end in the catch block. So I am not able the user details.

What could be the problem? Since I didn't make changes in the script so far, It is suddenly stopped working.

Mahesh
  • 1,503
  • 3
  • 22
  • 33

2 Answers2

0

It was a facebook bug. They fixed it last night. If you update your facebook php SDK it will work.

Andrew
  • 61
  • 3
0

You access token may be out of date, I suggest something like this:

try {
    $data['user_profile'] = $profile = $this->facebook->api('/me');

    }catch (Exception $e){
       $this->facebook->setAccessToken($this->facebook->getAccessToken());
    try {

        if($this->facebook->getUser()) {
        $this->facebook->api(array('method' =>'auth.revokeAuthorization' ));
       }

    }catch(Exception $e) {
        redirect(...);
    }
    redirect(...);
    }
carlosavoy
  • 99
  • 4