[英]Facebook login redirect issue
I have a site with a working Facebook login. 我有一个使用Facebook登录名有效的网站。
The problem is happens when the user comes to the site for the first time (or after clearing cookies). 当用户第一次访问该网站时(或清除cookie后),就会发生问题。
The user flow is the following: 用户流程如下:
The problem is that if the person is doing this for the first time, they are always redirected back to the home page . 问题在于, 如果此人是第一次这样做,则他们总是会被重定向回首页 。
There are only 2 possible views that can be given for this url 此网址只能提供2种可能的视图
Thus, I have ruled out PHP as a possible cause of the redirect. 因此,我排除了PHP作为重定向的可能原因。
I have included the JavaScript managing the Facebook interaction. 我已包括管理Facebook交互的JavaScript。
All other relevant code can be found in the HTML of the page. 所有其他相关代码都可以在页面的HTML中找到。
The Page can be found at http://trioisrael.com 该页面可在http://trioisrael.com上找到
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'
});
}
Trying to do additional stuff after assigning a new value to window.location
(which should be window.location.href
, of course) does not make sense. 在将新值分配给
window.location
(当然应该是window.location.href
)之后尝试做其他事情没有任何意义。
If you want to do additional stuff after login, do it before redirecting the user somewhere else. 如果要在登录后进行其他操作,请在将用户重定向到其他地方之前执行此操作。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.