0
我有一个很难得到Facebook的JS API来为http://developers.facebook.com/docs/reference/javascript/的Facebook要求用户登录,即使他们已经登录
具体描述工作,用户似乎得到要求登录即使他们已经登录到Facebook。对于这个我做了以下内容:
<div id="fb-root"></div>
<script>
window.fbAsyncInit = function() {
FB.init({
appId : '3120012412', // App ID goes here
channelURL : '//WWW.qy.ORG/channel.php', // Channel File
status : true, // check login status
cookie : true, // enable cookies to allow the server to access the session
oauth : true, // enable OAuth 2.0
xfbml : true // parse XFBML
});
// Additional initialization code here
FB.login(function(response) {
if (response.authResponse) {
alert('Welcome! Fetching your information.... ');
FB.api('/me', function(response) {
alert('Good to see you, ' + response.name + '.');
alert('response' + response);
FB.logout(function(response) {
alert('Logged out.');
});
});
} else {
alert('User cancelled login or did not fully authorize.');
}
}, {scope: 'email'});
};
// Load the 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));
</script>
我也试过:
FB.getLoginStatus(function(response) {
if (response.authResponse) {
// logged in and connected user, someone you know
} else {
// no user session available, someone you dont know
}
});
,当我在Facebook的我已经登录这也失败均匀。
如果我想让用户通过最低限度的麻烦,只需基本访问公共信息,该怎么办?我明白他们必须授权基本访问权限,但是不应该一再询问他们是否应该这样做?
非常感谢您的帮助! –
这是否解决了您的问题?如果有答案,请接受答案,否则请留下更多信息。 :) – Abby