0

スクリプトに何が起こったのかわかりません。うまく機能していましたが、突然メールを返さなくなりました (undefined が返されます) が、名、姓、およびユーザー名は正常に機能します。

ここにコードがあります

    <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>

何も変更していませんが、何が問題なのですか?

4

1 に答える 1

2

電子メールを取得するには、へのパラメータとしてではなく、{ scope: 'email' }に渡す必要があります。FB.loginFB.api

FB.login(function (response) {
   ...
}, { scope: 'email' });
于 2012-12-17T08:32:15.560 に答える