/**
  * @see BaseAuthenticate::getUser()
  */
 public function getUser(CakeRequest $request)
 {
     debug("FacebookAuthenticate::getUser()");
     $fbUser = FacebookConnect::user();
     debug($fbUser);
     // No facebook user is connected
     /*
     * {
          "id": "123456789",
          "name": "John Doe",
          "first_name": "John",
          "last_name": "Doe",
          "link": "https://www.facebook.com/john.doe",
          "username": "******",
          "gender": "male",
          "timezone": 1,
          "locale": "en_US",
          "verified": true,
          "updated_time": "2013-01-01T22:22:22+0000"
        }
     */
     if (!$fbUser) {
         return false;
     }
     // @todo check default permissions
     // A facebook user is connected, but no user model selected
     // So return facebook user info
     if (!$this->settings['userModel']) {
         return $fbUser;
     }
     return $this->_findFacebookUser($fbUser);
 }
예제 #2
0
 /**
  * Returns facebook user data
  *
  * @see FacebookConnect::getUser()
  * @param string $key
  * @return mixed
  */
 public function user($key = null)
 {
     return FacebookConnect::user($key);
 }