2012-12-17 3 views
0

내 스크립트에 어떤 일이 일어 났는지 잘 모르겠지만 갑자기 작동하지 않으면 이메일이 반환됩니다 (정의되지 않은 상태로 반환).하지만 성, 성 및 사용자 이름은 정상적으로 작동합니다. 여기facebook 로그인 스크립트가 작동을 멈췄습니다

코드 그래도 난 아무것도 변경 havent 한

<script type="text/javascript"> 


     // initialize the library with the API key 

     FB.init({ appId: 'XXXXXXXXXX',status: true, cookie: true, xfbml: true, oauth: true }); 

     function login() { 
      FB.login(function (response) { 
       if (response.authResponse) { 
        console.log('Welcome! Fetching your information.... '); 

        FB.api('/me', function (response) { 

         console.log('Good to see you, ' + response.name + '.email :' + response.email); 
         console.log('Good to see you, ' + ",gender:" + response.gender + "another : " + response.first_name); 
         console.log('Good to see you, ' + response.username + '.last_name :' + response.last_name); 
        // console.log('Good to see you, ' + response); 
        }, { scope: 'email' }); 
       } else { 
        console.log('User cancelled login or did not fully authorize.'); 
       } 
      }); 
     } 
    </script> 

, 무슨 일이 될 수있다?

+0

나는 페이스 북에 로그인 할 때 기본 정보 액세스 권한 만 묻는 메시지가 전혀 표시되지 않는다는 것을 잊어 버렸다. –

답변

2

이메일을 받으려면 FB.api의 매개 변수가 아닌 FB.login으로 { scope: 'email' }을 전달해야합니다.

FB.login(function (response) { 
    ... 
}, { scope: 'email' }); 
+0

그 덕분에, 고마워. –

관련 문제