我有一个刷新我的网址的 Facebook 按钮on-login
<fb:login-button perms="email,user_about_me,user_photos" on-login="window.location = 'http://myDomain.com';">Login</fb:login-button>
但是,如果我不想使用标准的 facebook 按钮并决定使用我自己的 javascript 标记,
我似乎很难在登录时获得回调
,这是我的尝试,任何建议或帮助都将不胜感激,
谢谢
function fb_oAuth(){
FB.ui({
method: "permissions.request",
"perms": 'email, user_about_me, user_photos'
} , function(response) {
console.log(response);
/* if (response.session) {
window.location.href = 'http://www.myDomain.com';
} */
});
/* FB.Event.subscribe('auth.sessionChange', function(response) {
if (response.session) {
window.location.href = 'http://www.myDomain.com';
} else {
// The user has logged out, and the cookie has been cleared
}
}); */
});
// HTML button
<a href="#" onClick="fb_oAuth(); event.preventDefault();">Login with Facebook</a>