我有一个有Facebook登录工作的网站。
当用户第一次来到网站时(或清除cookie后),就会出现问题。
用户流程如下:
问题在于如果此人第一次这样做,则会始终将其重定向回主页。
此网址只能提供2种可能的观点
因此,我已经排除了PHP作为重定向的可能原因。
我已经包含了管理Facebook互动的JavaScript。
所有其他相关代码都可以在页面的HTML中找到。
找到该页面function fb_login(){
FB.login(function(response) {
if (response.authResponse) {
window.location = "http://trioisrael.com/signup"
//console.log(response); // dump complete info
access_token = response.authResponse.accessToken; //get access token
user_id = response.authResponse.userID; //get FB UID
FB.api('/me', function(response) {
user_email = response.email; //get user email
// you can store this data into your database
});
} else {
//user hit cancel button
alert('We use facebook to make sure that everyone is really who they say they are');
}
}, {
scope: 'user_photos,user_birthday'
});
}
答案 0 :(得分:1)
在为window.location
分配新值(当然应该是window.location.href
)之后尝试执行其他操作是没有意义的。
如果您想在登录后执行其他操作,请在将用户重定向到其他位置之前执行。