簡體   English   中英

Facebook在不要求身份驗證的情況下獲取用戶名

[英]Facebook get username without requesting authentication

我已經嘗試了無數個示例。.是否有任何真正的方法可以在不使用彈出窗口請求身份驗證的情況下使用JavaScript sdk在風扇頁面應用程序中獲取當前用戶名?

這是我當前的JS:

window.fbAsyncInit = function() {
    FB.init({
        appId      : 'ID', // App ID
        channelUrl : 'url/channel.php', // Channel File
        status     : true, // check login status
        cookie     : true, // enable cookies to allow the server to access the session
        frictionlessRequests : true, // enable frictionless requests
        xfbml      : true  // parse XFBML
    });
    // Additional initialization code here

    FB.api('/me', function(response) {
    console.log("Welcome " + response.name);
});
};

// Load the JavaScript SDK Asynchronously
(function(d){
  var js, id = 'facebook-jssdk'; if (d.getElementById(id)) {return;}
  js = d.createElement('script'); js.id = id; js.async = true;
  js.src = "//connect.facebook.net/en_US/all.js";
  d.getElementsByTagName('head')[0].appendChild(js);
}(document));

然后是我的PHP:

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:og="http://ogp.me/ns#">
<head>
  <meta charset="utf-8" />
  <title>View Source App</title>
   <script type="text/javascript" src="script/jquery.min.js"></script>
   <script type="text/javascript" src="script/script.js"></script>
</head>
<body>
    <div id="fb-root"></div>
  <div id="content">
  <h2>My First App</h2>
  <p>This is some text to make sure my app is working on Facebook</p>
  </div><!--content -->
</body>
</html>

非常感謝任何幫助。

最簡潔的答案是不。 您需要訪問任何用戶數據的權限。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM