使用facebook登录不起作用,案例刷新循环

使用facebook登录不起作用,案例刷新循环,facebook,api,Facebook,Api,在我的一个网站上,我们使用facebook脚本实现了登录。直到昨天它还可以正常工作,但突然之间剧本似乎出现了问题。如果我已经登录了facebook,我的网站页面会不断刷新。如果我退出facebook,刷新就会停止 如果这是facebook的脚本问题,那么我认为会有很多其他人面临这个问题。这里有人也面临这个问题吗? 如果有,请分享并提供解决方案 谢谢 Ishan我们也遇到了同样的问题,我们开始使用Fb.getLoginStatus而不是Fb.Login,并根据用户的状态手动将其重定向到登录页面

在我的一个网站上,我们使用facebook脚本实现了登录。直到昨天它还可以正常工作,但突然之间剧本似乎出现了问题。如果我已经登录了facebook,我的网站页面会不断刷新。如果我退出facebook,刷新就会停止

如果这是facebook的脚本问题,那么我认为会有很多其他人面临这个问题。这里有人也面临这个问题吗? 如果有,请分享并提供解决方案

谢谢


Ishan

我们也遇到了同样的问题,我们开始使用Fb.getLoginStatus而不是Fb.Login,并根据用户的状态手动将其重定向到登录页面

    FB.getLoginStatus(function (response) {
             if (response.status === 'connected') {
                 // the user is logged in and has authenticated your
                 // app, and response.authResponse supplies
                 // the user's ID, a valid access token, a signed
                 // request, and the time the access token 
                 // and signed request each expire
                 FB.api('/me', function (userDetails) {
                     LoadRegForm(userDetails);
                 });

             } else if (response.status === 'not_authorized') {
                 Rediret to facebook oauth page
              top.location.href = 'https://www.facebook.com/dialog/oauth?client_id=<%= ConfigurationManager.AppSettings["fbappid"] %>&redirect_uri=<%= ConfigurationManager.AppSettings["fbcanvasurl"] %>&scope=email,user_birthday,user_education_history';

             } else {
                 // the user isn't logged in to Facebook.
                 top.location.href = 'https://www.facebook.com/dialog/oauth?client_id=<%= ConfigurationManager.AppSettings["fbappid"] %>&redirect_uri=<%= ConfigurationManager.AppSettings["fbcanvasurl"] %>&scope=email,user_birthday,user_education_history';
             }
FB.getLoginStatus(函数(响应){
如果(response.status===“已连接”){
//用户已登录并已验证您的身份
//app和response.authResponse提供
//用户ID、有效访问令牌、签名
//请求,以及访问令牌的时间
//和签名的请求都将过期
api('/me',函数(userDetails){
LoadRegForm(用户详细信息);
});
}else if(response.status===“未授权”){
重拨至facebook oauth页面
top.location.href=https://www.facebook.com/dialog/oauth?client_id=&redirect_uri=&scope=email,用户_生日,用户_教育_历史';
}否则{
//用户未登录到Facebook。
top.location.href=https://www.facebook.com/dialog/oauth?client_id=&redirect_uri=&scope=email,用户_生日,用户_教育_历史';
}

您甚至可以在两个else块中调用FB.Login函数来代替重定向。

我们也遇到了同样的问题,我们开始使用FB.getLoginStatus代替FB.Login,并根据用户的状态手动将其重定向到登录页面

    FB.getLoginStatus(function (response) {
             if (response.status === 'connected') {
                 // the user is logged in and has authenticated your
                 // app, and response.authResponse supplies
                 // the user's ID, a valid access token, a signed
                 // request, and the time the access token 
                 // and signed request each expire
                 FB.api('/me', function (userDetails) {
                     LoadRegForm(userDetails);
                 });

             } else if (response.status === 'not_authorized') {
                 Rediret to facebook oauth page
              top.location.href = 'https://www.facebook.com/dialog/oauth?client_id=<%= ConfigurationManager.AppSettings["fbappid"] %>&redirect_uri=<%= ConfigurationManager.AppSettings["fbcanvasurl"] %>&scope=email,user_birthday,user_education_history';

             } else {
                 // the user isn't logged in to Facebook.
                 top.location.href = 'https://www.facebook.com/dialog/oauth?client_id=<%= ConfigurationManager.AppSettings["fbappid"] %>&redirect_uri=<%= ConfigurationManager.AppSettings["fbcanvasurl"] %>&scope=email,user_birthday,user_education_history';
             }
FB.getLoginStatus(函数(响应){
如果(response.status===“已连接”){
//用户已登录并已验证您的身份
//app和response.authResponse提供
//用户ID、有效访问令牌、签名
//请求,以及访问令牌的时间
//和签名的请求都将过期
api('/me',函数(userDetails){
LoadRegForm(用户详细信息);
});
}else if(response.status===“未授权”){
重拨至facebook oauth页面
top.location.href=https://www.facebook.com/dialog/oauth?client_id=&redirect_uri=&scope=email,用户_生日,用户_教育_历史';
}否则{
//用户未登录到Facebook。
top.location.href=https://www.facebook.com/dialog/oauth?client_id=&redirect_uri=&scope=email,用户_生日,用户_教育_历史';
}

你甚至可以在两个else块中调用FB.Login函数,而不是重定向。

既然你说的是刷新,我假设你没有使用FB.Login,只是使用redirect\u uri参数或其他东西将用户重定向到登录url。他们登录后,Facebook会将用户返回到你的页面。你有什么检查吗要查看当前访问者是否已登录,请执行以下操作:
if(loggedIn){displayPage();}else{top.location.href=loginUrl}
?还有,你在用什么SDK?既然你说的是刷新,我假设你没有使用FB.login,只是用redirect\u uri参数或其他东西将用户重定向到登录url。在他们登录后,Facebook会将用户返回到你的页面。你有没有检查当前访问者是否已经登录?那么类似于
if(loggedIn){displayPage();}else{top.location.href=loginUrl}
?另外,您正在使用什么SDK?