Note that there are some explanatory texts on larger screens.

plurals
  1. POcakephp facebook api, FB->api('/me') returns empty value
    text
    copied!<p>I use <a href="http://www.webtechnick.com/wtn/blogs/view/229/CakePHP_Facebook_Plugin_Auth_Facebook_and_more" rel="nofollow">Webtechnick Facebook plugin</a> for cakephp 1.3 website. I implemented it about a year ago. And it worked fine until now. But today I found out that when I try to login(as a new user) it does not save facebook user data, because <code>$this-&gt;Connect-&gt;user()</code> (which result is taken from <code>$this-&gt;FB-&gt;api('/me')</code>, <code>/plugins/facebook/controller/components/connect.php, line 194</code>) returns nothing. I tried also, <a href="https://github.com/stefan-zh/Facebook-Connect-Plugin-CakePHP" rel="nofollow">this facebook plugin</a> on another cakephp 2.0 website, but the same thing was there.</p> <p>I think, that there was some change in facebook api, because I did not absolutely make any change on the website, which could bring to that result.</p> <p>this is <code>user</code> function in <code>connect.php</code> component</p> <pre><code>function user($field = null){ if(isset($this-&gt;uid)){ $this-&gt;uid = $this-&gt;uid; if($this-&gt;Controller-&gt;Session-&gt;read('FB.Me') == null){ $this-&gt;Controller-&gt;Session-&gt;write('FB.Me', $this-&gt;FB-&gt;api('/me')); } $this-&gt;me = $this-&gt;Controller-&gt;Session-&gt;read('FB.Me'); } else { $this-&gt;Controller-&gt;Session-&gt;delete('FB'); } if(!$this-&gt;me){ return null; } if($field){ $retval = Set::extract("/$field", $this-&gt;me); return empty($retval) ? null : $retval[0]; } return $this-&gt;me; } </code></pre> <p>and my <code>beforeFacebookSave()</code> function in <code>app_controller</code></p> <pre><code>public function beforeFacebookSave() { $fbUser = $this-&gt;Connect-&gt;user (); //debug($fbUser); // outputs nothing $this-&gt;Connect-&gt;authUser ['User'] ['email'] = $fbUser ['email']; $this-&gt;Connect-&gt;authUser ['User'] ['first_name'] = $fbUser ['first_name']; $this-&gt;Connect-&gt;authUser ['User'] ['last_name'] = $fbUser ['last_name']; return true; } </code></pre> <p>Thank you !</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