当用户单击我网站上的 Facebook 登录按钮时,我正在使用 JS SDK 显示请求对话框。现在,我想在用户发送邀请或取消请求对话框后重定向用户,以便我可以继续在站点中为他或她签名。
button = document.getElementById('fbc-login-button');
button.onclick = function() {
FB.getLoginStatus(function(response) {
if (response.authResponse) {
sendRequestViaMultiFriendSelector(response.authResponse.accessToken);
}
else {
FB.login(function(response) {
if (response.authResponse) {
sendRequestViaMultiFriendSelector(response.authResponse.accessToken);
}}, {scope: 'email'});
}
});
};
function sendUserToLoginProcess(accessToken){
var fb_signin_url = '<?php echo CustomLocal_Resource_Url_Process::userSignin() ?>?command=<?php echo CustomLocal_Logic_Customer_User::COMMAND_FB_SIGNIN ?>&url_redirect=<?php echo Custom_Resource_Url_Customer::main(); ?>&url_redirect_fail=<?php echo Custom_Resource_Url_Customer::signin(); ?>';
this.location = fb_signin_url + '&token=' + accessToken;
};
function sendRequestViaMultiFriendSelector(accessToken) {
FB.ui({method: 'apprequests',
message: 'My Great Request'
}, sendUserToLoginProcess(accessToken));
}