2013-05-13 68 views
0

我已經從我的asp.net項目中獲得用戶個人信息,包括用戶名,生日,電子郵件,個人資料圖片和facebook的性別,現在我想獲得城市和關於我的細節,我試圖像以前一樣獲得這些,但不幸的是我無法做到這一點。從FB到Asp.Net獲取城市和關於我的信息

我跟着這個link看到擴展配置文件權限,但我仍然無法做到這一點。

這裏是我的腳本

<script type="text/javascript" src="http://code.jquery.com/jquery-latest.js"></script> 
    <script> 
     // Load the SDK Asynchronously 
     (function (d) { 
      var js, id = 'facebook-jssdk', ref = d.getElementsByTagName('script')[0]; 
      if (d.getElementById(id)) { return; } 
      js = d.createElement('script'); js.id = id; js.async = true; 
      js.src = "//connect.facebook.net/en_US/all.js"; 
      ref.parentNode.insertBefore(js, ref); 
     } (document)); 

     // Init the SDK upon load 
     window.fbAsyncInit = function() { 
      FB.init({ 
       appId: '155578484623690', // App ID 
       channelUrl: '//' + window.location.hostname + '/channel', // Path to your Channel File 
       scope: 'id,name,gender,user_birthday,email,user_about_me,user_location', 
       status: true, // check login status 
       cookie: true, // enable cookies to allow the server to access the session 
       xfbml: true // parse XFBML 
      }); 
      // listen for and handle auth.statusChange events 
      FB.Event.subscribe('auth.statusChange', function (response) { 
       if (response.authResponse) { 
        // user has auth'd your app and is logged into Facebook 
        var uid = "http://graph.facebook.com/" + response.authResponse.userID + "/picture"; 
        FB.api('/me', function (me) { 
         if (me.name) { 
          document.getElementById('txtDisplayName').innerHTML = me.name; 
          document.getElementById('Email').innerHTML = me.email; 
          document.getElementById('BD').innerHTML = me.birthday; 
          document.getElementById('profileImg').src = uid; 
          document.getElementById('Gender').innerHTML = me.gender; 
          document.getElementById('city').innerHTML = me.about; 
          document.getElementById('city').innerHTML = me.location; 
         } 
        }) 
        document.getElementById('auth-loggedout').style.display = 'none'; 
        document.getElementById('auth-loggedin').style.display = 'block'; 
       } else { 
        // user has not auth'd your app, or is not logged into Facebook 
        document.getElementById('auth-loggedout').style.display = 'block'; 
        document.getElementById('auth-loggedin').style.display = 'none'; 
       } 
      }); 
      $("#auth-logoutlink").click(function() { FB.logout(function() { window.location.reload(); }); }); 
     } 
    </script> 
+0

這就是爲什麼我刪除了我的FB帳號...但我希望你能找到你的答案 – Yeronimo 2013-05-13 10:48:14

+0

@Anvesh Saxena先生,我得到的城市,但我在https://developers.facebook.com/docs/reference/login/extended-profile-properties/找不到任何「生物」。 那麼你建議什麼? – aami 2013-05-13 12:21:38

回答

0

根據documentation有關用戶,

  • 有像about的用戶,而不是將其用於Page對象沒有現場。對於用戶而言,您可能需要的字段是bio

  • 其次,location字段還包含idname的位置。因此,而不是使用me.location你想使用me.location.name爲用戶位置的名稱