카테고리 없음

[자바 스크립트] Facebook API를 통해 사용자 이메일을 가져올 수 없습니다.

필살기쓰세요 2021. 1. 15. 16:33

로그인 프로세스에서 이메일 권한을 요청해야합니다.

FB.login(function(response) {
    if (response.authResponse) {
            //user just authorized your app
            
                }
                }, {scope: 'email'});
                

Btw, 이것은 정확합니다 (최신 ES6 화살표 기능도 포함) :

FB.api('/me', {fields: 'name,email'}, (response) => {
     console.log(response.name + ' --- ' + response.email);
     });
     

추가 정보 : http://www.devils-heaven.com/facebook-javascript-sdk-login/



출처
https://stackoverflow.com/questions/39915917