0
나는 이것이 중복이라는 것을 알고 있지만, 나는 다른 질문에서 제시된 모든 것을 거의 시도했다.CodeIgniter Facebook API getuser 항상 0
getUser는 앱을 승인 한 후에도 항상 0을 반환하기 때문에 현재 리디렉션 루프가 발생합니다.
코드 : 여기
public function auth() {
$user = $this->facebook->getUser();
if ($user) {
$user = $this->facebook->api('/me');
if (!$this->Users->getByID($user["id"])) {
$this->data->needsRegister = true;
} else {
$toSetInSessions = new stdClass();
$toSetInSessions->authed = 1;
$dbUser = $this->Users->getByID($user["id"]);
foreach ($dbUser as $key => $value) {
$toSetInSessions->user->$key = $value;
}
$this->session->set_userdata($toSetInSessions);
redirect("/");
}
} else {
$params = array('scope' => 'email,read_friendlists');
if ($_SERVER['HTTP_USER_AGENT'] != "facebookexternalhit/1.1 (+http://www.facebook.com/externalhit_uatext.php)") {
redirect($this->facebook->getLoginUrl($params));
}
}
$this->load->view('header', $this->data);
$this->load->view('auth', $this->data);
$this->load->view('footer', $this->data);
}
는이 응용 프로그램에 대한 내 설정 페이지의 스크린 샷이다.
https://dl.dropbox.com/u/6647629/facebookapp.png
은 때때로 작업을 수행하지만, 대부분의 시간은하지 않습니다.