Oauth를 사용하여 내 웹 사이트에 Facebook 가입/로그인을 설정했습니다.이메일은 더 이상 페이스 북을 통해 반환되지 않습니다 oauth
$code = $_GET['code'];
$tokenURL = "https://graph.facebook.com/oauth/access_token?client_id=[appID]&redirect_uri=[encoded_url]&client_secret=[secret_key]&code=" . $code;
// request access token
//use curl and not file_get_contents()
$ch = curl_init();
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_URL, $tokenURL);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
$accessToken = curl_exec($ch);
curl_close($ch);
$graphURL = "https://graph.facebook.com/me?" . $accessToken;
// request user data using the access token
$ch = curl_init();
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_URL, $graphURL);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
$tempUser = curl_exec($ch);
curl_close($ch);
//decode the json array to get user data
$user = json_decode($tempUser);
//store user data
$firstName = cleanWords($user->first_name);
$lastName = cleanWords($user->last_name);
$email = cleanEmail($user->email);
: 나는이 다음과 같은 코드가있는 페이지로 이동됩니다
http://www.facebook.com/dialog/oauth?client_id=[appID]&redirect_uri=[encoded_URL]&scope=email,user_likes,publish_stream
API를 내 호출의 범위에 포함이 철수 이메일이었다 데이터의 조각 중 하나는, 이것은 잘 작동하는 데 사용되지만 갑자기 사용자가 응용 프로그램을 처음 사용할 때 전자 메일을 제공 할 수있는 권한을 부여하더라도 전자 메일이 더 이상 JSON 객체에 반환되지 않는다는 것을 알았습니다. API를 변경하여 이메일을 다르게 처리해야합니까? 사용자가 이메일을 앱과 공유하도록 명시 적으로 권한을 부여하지 않은 경우 반환되지는 않지만 계정에서 이러한 설정을 찾을 수 없다는 게시물이있었습니다.
다른 사람이 나에게 그 설정이 어디에 있는지 알려주십시오. 그게 문제인지 테스트 할 수 있습니까? 아니면 전자 메일이 같은 방식으로 더 이상 액세스 할 수 없으며 변경해야하는 항목이 있으면 알려주십시오. 감사합니다.
업데이트 : 새로운 Facebook API를 사용하기 위해 코드를 완전히 다시 작성함으로써이 작업을 수행했습니다.
동일한 문제가 발생했는데 원인을 파악 했습니까? –
나는 문제를 발견하지 못했지만 방금 코드를 다시 작성했습니다. –