You are using the PHP SDK framework on the right. In facebook php sdk when you call
$ facebook-> getUser () method first check its private variable if the user is already set or not here, this is the method
* Get the UID of the connected user, or 0 * if the Facebook user is not connected. * * @return string the UID if available. */ public function getUser() { if ($this->user !== null) {
so if you call the first time variable user , it is null
now it calls getUserFromAvailableData (); Method
public function getSignedRequest() { if (!$this->signedRequest) { if (isset($_REQUEST['signed_request'])) { $this->signedRequest = $this->parseSignedRequest( $_REQUEST['signed_request']); } else if (isset($_COOKIE[$this->getSignedRequestCookieName()])) { $this->signedRequest = $this->parseSignedRequest( $_COOKIE[$this->getSignedRequestCookieName()]); } } return $this->signedRequest; }
and getSignedRequestCookieName() return
protected function getSignedRequestCookieName() { return 'fbsr_'.$this->getAppId(); }
now the getSignedRequest() function first checks if the signed request is installed or not, if not installed, it receives the signed request from the cookie
therefore, if, finally, if you do not want to receive the previous user ID, simply delete the cookie named ''fbsr_'+YourApplicationID'
source share