1

我会为我的 FB iframe 应用程序使用 Facebook JavaScript SDK。我想在登录状态下获取用户电子邮件 ID

这是我的代码......

 <html>
  <head>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
    <title>Mettter</title>
  </head>
    <script src="http://connect.facebook.net/en_US/all.js"></script>
        <div id="fb-root"></div>

   <script>
   FB.init({appId:'1*********', xfbml: true, cookie: true, oauth: true, fbconnect: false});                 FB.getLoginStatus(function(response) {
               if (response.authResponse) {
                 // logged in and connected user, someone you know
                 FB.api('/me', function(resp) {
                      alert('Your name is... ' + resp.name);
                     alert('Your email is.... ' + resp.email);

                    });
               } else {
                 // no user session available, someone you dont know
                 alert("i dont know ");
                 FB.api('/me', function(res) {
                      alert('Your name is ' + res.name);
                     alert('Your email is ' + res.email);

                    });

               }
             });

         </script>
  <body>
    <h1>Welcome</h1>



  </body>
</html>

现在,当我点击我的应用程序 URL 时.. 我看到登录到应用程序窗口我单击登录然后我看到允许窗口要求发布流,当我单击允许时触发 else 警报并包含未定义而不是名称和电子邮件和URL 包含此消息

http://apps.facebook.com/palmchipprojecta/?error_reason=user_denied&error=access_denied&error_description=The+user+denied+your+request.#_=_

我没有得到它有什么问题?

4

0 回答 0