它不会打开任何东西。
function logIN()
{
FB.ui({
method: 'auth.login',
perms: 'email',
display: 'iframe' },
function(response) {
/* */
});
}
答案 0 :(得分:1)
我相信这应该是你的功能:
FB.ui({
method: 'oauth',
display: 'popup',
scope: 'email',
response_type: 'token',
redirect_uri: 'WHEREYOUWANTTOPROCESSTOKEN',
client_id: 'YOURAPPID',
});
请注意,只有page
或popup
是display
的有效类型
答案 1 :(得分:1)
此示例可能有所帮助:http://fbrell.com/auth/login-and-logout
<button id="fb-auth">Login</button>
<script>
function updateButton(response) {
console.log('Updating Button', response);
var button = document.getElementById('fb-auth');
if (response.session) {
button.innerHTML = 'Logout';
button.onclick = function() {
FB.logout(function(response) {
console.log('FB.logout callback', response);
});
};
} else {
button.innerHTML = 'Login';
button.onclick = function() {
FB.login(function(response) {
console.log('FB.login callback', response);
if (response.session) {
console.log('User is logged in');
} else {
console.log('User is logged out');
}
});
};
}
}
// run it once with the current status and also whenever the status changes
FB.getLoginStatus(updateButton);
FB.Event.subscribe('auth.statusChange', updateButton);
</script>