페이스북 로그인시 이메일정보 채택완료
RinaP
8년 전
조회 3,420
callback.php페이지에서
$content = $facebook->api('/me');
print_r($content);
echo "<br/>".$content['email'];
$content값을 확인하면 Array ( [name] => 이름 [id] => 1234567896082970 ) name랑 id값이나오고요
$content['email']로 값을 확인하면 이메일 정보는 넘어오지않아요....
혹시 다른페이지에서 변경해줘야될 값이 있는지;; 문의드려요 ㅠ
댓글을 작성하려면 로그인이 필요합니다.
답변 2개
채택된 답변
+20 포인트
8년 전
로그인 URL을 생성하실 때 수집 항목에 추가 하셔야 합니다.
https://developers.facebook.com/docs/facebook-login/web/permissions">https://developers.facebook.com/docs/facebook-login/web/permissions
이 페이지 참고하세요. ^^
로그인 후 평가할 수 있습니다
답변에 대한 댓글 5개
R
RinaP
8년 전
이메일권한이랑 게시글권한은 처음에 딱 회원가입누르면 페북 아이디비번입력하고 동의하는창떠서 동의해주고요...동의를했는데 이상하게...안가져오네요....social_login경로에 있는 플러그인이고요 로그인자체도안되고있어서 어제 잉끼다님이 작성하신 페이스북 로그인 안되시는 분들 참고해주세요.글보고 수정해주니 로그인은 되더라고요....동의창에 동의해주고 하는데 권한문제일까요....현재 저희 앱키받은 페북계정을.....다들모르고계셔서.....ㅜ
�
잉기
8년 전
정확한 내용은 페이지를 봐야 알 것 같습니다. ㅠㅠ
R
RinaP
8년 전
어떻게 보여드리면 될까요?!!
�
잉기
8년 전
알려줘보세요.
R
RinaP
8년 전
오,,,,답변에 로그인하고 권한받은뒤 돌아오는 callback.php페이지에요! 혹시 더 필요하신 페이지있으시면 말씀해주세요!
댓글을 작성하려면 로그인이 필요합니다.
8년 전
</p><p>//ver1.0 150517 @_untitle_d
require_once(G5_PLUGIN_PATH.'/social_login/fb/facebook.php');</p><p>$config = array(
'appId' => FB_CONSUMER_KEY,
'secret' => FB_CONSUMER_SECRET
);</p><p>$facebook = new Facebook($config);</p><p>$user = $facebook->getUser();
// echo $user;
// exit;
if ($user){
try{
$content = $facebook->api('/me');
print_r($content);
echo "
".$content['link'];
exit;
$str = "<a href='".$content['link']."' target='_blank'>".$content['first_name']."</a>
<font style='color:#c5c5c5'>(".($content['gender']=='female'?'♀':'♂').")</font>
<font style='color:#a1a1a1'>".str_replace(<a href="mailto:'@'">'@'</a>, ' (at) ', $content['email'])."</font>";
$row = sql_fetch(" select count(*) as cnt from {$g5['member_table']} where mb_9 = '".$content['id']."' and mb_10 = 'fb' ");
if ($row['cnt']){</p><p> sl_login($content['id'], 'fb');</p><p> //소셜로그인
set_session('sl_id', $content['id']);
set_session('sl_sns', 'fb');
set_session('sl_str', $str);
set_session('sl_picture', '<a href="<a href="https://graph.facebook.com/" target="_blank" rel="noopener noreferrer">https://graph.facebook.com/</a>"><a href="https://graph.facebook.com/" target="_blank" rel="noopener noreferrer">https://graph.facebook.com/</a></a>'.$content['id'].'/picture');
goto_url('/');
}else{
$row = sql_fetch(" select count(*) as cnt from `{$g5['member_table']}` where mb_email = '".$content['email']."' ");
if ($row['cnt']) alert('이미 사용중인 E-mail 주소입니다.', '/');
$fb_user = array(
'mb_id' => sl_id_check('fb'),
'mb_password' => SL_PASSWORD.$content['id'],
'mb_email' => $content['email'],
'mb_name' => str_replace(' ', '', $content['name']),
'mb_nick' => sl_nick_check(str_replace(' ', '', $content['first_name'])),
'mb_homepage' => $content['link'],
'mb_8' => '<a href="<a href="https://graph.facebook.com/" target="_blank" rel="noopener noreferrer">https://graph.facebook.com/</a>"><a href="https://graph.facebook.com/" target="_blank" rel="noopener noreferrer">https://graph.facebook.com/</a></a>'.$content['id'].'/picture',
'mb_9' => $content['id'],
'mb_10' => 'fb'
);
$result = sl_register($fb_user); //회원가입
if ($result){
sl_login($content['id'], 'fb');
//소셜로그인
set_session('sl_id', $content['id']);
set_session('sl_sns', 'fb');
set_session('sl_str', $str);
set_session('sl_picture', '<a href="<a href="https://graph.facebook.com/" target="_blank" rel="noopener noreferrer">https://graph.facebook.com/</a>"><a href="https://graph.facebook.com/" target="_blank" rel="noopener noreferrer">https://graph.facebook.com/</a></a>'.$content['id'].'/picture');
goto_url(G5_BBS_URL.'/member_confirm.php');
}
}
</p><p>
}catch(FacebookApiException $e) {
error_log($e);
$user = NULL;
}
}else{
//die('Error');
header('Location: /');
break;
}</p><p>
로그인 후 평가할 수 있습니다
답변에 대한 댓글 2개
�
잉기
8년 전
이 부분 말고 로그인 URL 생성하는 부분이요,
R
RinaP
8년 전
했어요했어요!!
url부분이 여기를 말하시는거였군요 ㅠ
$content = $facebook->api('/me');여기에 혹시나하고 붙였더니 와요!값이 ㅠㅠ
$content = $facebook->api('/me?fields=email');아래처럼했어요 ㅠ감사합니다
url부분이 여기를 말하시는거였군요 ㅠ
$content = $facebook->api('/me');여기에 혹시나하고 붙였더니 와요!값이 ㅠㅠ
$content = $facebook->api('/me?fields=email');아래처럼했어요 ㅠ감사합니다
댓글을 작성하려면 로그인이 필요합니다.
답변을 작성하려면 로그인이 필요합니다.
로그인