2014-10-16 3 views
0
내가 페이스 북에 로그인을하려고

, 나는이 코드를 구축 다른 ID를 줘 :로그인, 페이스 북은

<?php 
ob_start(); 
include("facebook_constants.php"); // in this file i have appid and appsecretid 

$users = $facebook->getUser(); 

if ($users!="") { 
    try { 


    $user_profile = $facebook->api('/me','GET'); 

    $logoutUrl = $facebook->getLogoutUrl(); 
    $fuserid=$user_profile["id"]; // give me the id of the user 
    $fusername=$user_profile["name"]; // give me the name of the user 
    $femail=$user_profile["email"]; // give me the email of the user 

    $fusernamenew = str_replace(' ', '', $fusername); // change the name to username (omer lol = omerlol) 

    $newtoken=base64_encode($fuserid."::".$fusernamenew."::".$femail); // data to token 

    $itsme = $this->haimz->DB->num_rows("SELECT id FROM users WHERE fbid = ?haimz?", $fuserid); // if have user with that id = login , if not goto register page 

    if($itsme > 0){ 
echo "goto login page"; 
    } 
    else{  
echo "goto register page"; 
     exit; 
    } 

    } catch (FacebookApiException $e) { 
    $users = null; 
    } 
} 
?> 

은 $ fuserid 나에게 다른 사용자 ID를 제공하지만 $의 fusername 및 $ 나에게주는 femail 맞다. 사용자의 사용자 ID가 아닙니다. 다른 사용자 ID.

답변

0

https://developers.facebook.com/docs/apps/changelog

명이 그래프 API 2.0을 사용하여 업그레이드 된 앱 버전에 로그인 할 때

더 나은 사람들의 정보를 보호하기 위해, 페이스 북은 지금보다는 응용 범위의 ID를 발급합니다 사람의 원래 신분증. 그러나 이전에 앱에 로그인 한 사용자의 경우 사용자 ID가 변경되지 않습니다.

개인 정보 보호를 위해 더 이상 사용자의 "실제"ID를 얻지 못합니다. 앱에서만 고유 한 App Scoped ID 만받습니다. 사용자가 App Scoped ID를 사용하여 App으로 돌아 왔을 때 사용자를 식별하기 위해이 ID를 계속 사용할 수 있습니다.이 ID는 다른 App에서만 다를 수 있습니다. 필요한 경우

또한, 비즈니스 매핑 API와 다른 앱과 앱 범위가 지정된 ID를 매핑 할 수 있습니다 : https://developers.facebook.com/docs/apps/for-business

+0

확인. 고맙습니다! 하지만 어떻게 허가를 요청할 수 있습니까 ?? –

+0

무슨 허가? 더 이상 "진짜"ID를 얻을 수있는 방법이 없습니다. – luschn