【问题标题】:Facebook authenticated referrals is not workingFacebook 认证的推荐不起作用
【发布时间】:2012-09-26 17:04:19
【问题描述】:

我对“身份验证”对话框中的经过身份验证的推荐有疑问。当用户第一次使用应用程序并请求授权时,他/她会得到“应用程序将收到:您的基本数据”。这与我在 Facebook 开发者应用程序站点中预览 Auth Dialog 时显示的内容不同。我使用以下代码:

<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      : '<%= Facebook::APP_ID %>', // App ID
  channelUrl : '//'+window.location.hostname+'/channel', // Path to your Channel File
  status     : true, // check login status
  cookie     : true, // enable cookies to allow the server to access the session
  xfbml      : true  // parse XFBML
});

url = '<%= users_path %>'
// 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
  FB.api('/me', function(me){
    if (me.name) {
      window.open(url);
    }
  })
} else {
  // user has not auth'd your app, or is not logged into Facebook
  document.getElementById('auth-loggedout').style.display = 'block';
}

});

// respond to clicks on the login and logout links
document.getElementById('auth-loginlink').addEventListener('click', function(){
FB.login();

});

}

【问题讨论】:

    标签: javascript facebook authorization


    【解决方案1】:

    将 FB.login() 替换为

    FB.login(function(response) {
       // handle the response
     }, {scope : 'user_likes'});  });
    

    【讨论】:

      猜你喜欢
      • 2012-06-11
      • 2020-06-04
      • 2011-04-01
      • 1970-01-01
      • 1970-01-01
      • 2010-11-07
      • 2023-04-01
      • 2011-06-07
      • 1970-01-01
      相关资源
      最近更新 更多