Facebook graph api 无法从服务器端检索facebook access_令牌,SDK加载速度太慢?

Facebook graph api 无法从服务器端检索facebook access_令牌,SDK加载速度太慢?,facebook-graph-api,oauth-2.0,coldfusion-7,Facebook Graph Api,Oauth 2.0,Coldfusion 7,嗨,我使用的是一个非官方的,我不得不把它从使用CFscript转换成传统的CFFunction,因为我仍然使用CF7。 一切似乎都在工作,但我不知道为什么当试图在服务器端的登录上查找cookie时找不到它。这似乎是好的合唱,但FF,IE和歌剧都有相同的问题 在index.cfm上,我有一个fb:login按钮,当按下该按钮时,您将进入登录屏幕,成功登录后,index.cfm刷新运行我的FacebookApp方法,但从服务器端读取时,返回access_令牌的空白值。这是因为在服务器端,我试图从co

嗨,我使用的是一个非官方的,我不得不把它从使用CFscript转换成传统的CFFunction,因为我仍然使用CF7。 一切似乎都在工作,但我不知道为什么当试图在服务器端的登录上查找cookie时找不到它。这似乎是好的合唱,但FF,IE和歌剧都有相同的问题

在index.cfm上,我有一个fb:login按钮,当按下该按钮时,您将进入登录屏幕,成功登录后,index.cfm刷新运行我的FacebookApp方法,但从服务器端读取时,返回access_令牌的空白值。这是因为在服务器端,我试图从cookie中获取信息,但cookie尚未创建。我还输出了access_token的值,但返回为空。大约一秒钟后,当我按F5时,我现在可以在输出中看到我的访问令牌的值。同时,如果我使用js警报在getLoginStatus中显示access_令牌,我可以看到该值

我在一些地方读到过关于旧浏览器的文章,其中SDK加载速度慢,无法使用channelURL参数,我已经这样做了,但我仍然得到了与上面相同的结果

有什么建议我能做什么?我尝试添加js timeout来减慢getLoginStatus的运行速度,这样就有时间阅读cookie了,但我没有任何乐趣。请帮忙

在这一页的顶部我有这个

<!doctype html PUBLIC "-//W3C//Dtd html 4.0 Transitional//EN">
<html xmlns:og="http://ogp.me/ns#" xmlns:fb="http://www.facebook.com/2008/fbml">

在body标签之后,我有以下内容

    <div id="fb-root"></div>

            <script>
              window.fbAsyncInit = function() {
                 FB.init({
                  appId  : 'xxxxxxxxxxxxxxxx',
                  cookie  : true, // enable cookies to allow the server to access the session
                  oauth   : true, // OAuth 2.0
                  status  : true, // check login status
                  xfbml   : true, // parse XFBML
                  channelUrl: document.location.protocol + './/www.sitename.com/fbchannel.html' //custom channel
                });

                // whenever the user logs in or logs out, we refresh the page
                FB.Event.subscribe('auth.login', function(response) {
                   window.location.reload();
                   alert('login');
                });

                FB.Event.subscribe('auth.logout', function(response) {
                   window.location.reload();
                   //alert('logout');
                });

                FB.getLoginStatus(function(response) {
                  if (response.status == 'connected') {
                    // the user is logged in and connected to 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
                    var uid = response.authResponse.userID;
                    var accessToken = response.authResponse.accessToken;

                    //alert('end');
                   // alert('login url called '+unescape(window.location.pathname));
                    // whenever the user logs in we refresh the page

                    //alert(accessToken);

                  } else if (response.status == 'not_authorized') {
                    // the user is logged in to Facebook, 
                    //but not connected to the app
                  } else {
                    // the user isn't even logged in to Facebook.
                  }
                 });

              };

              (function() {
                var e = document.createElement('script');
                e.src = document.location.protocol + '//connect.facebook.net/en_US/all.js';
                e.async = true;
                document.getElementById('fb-root').appendChild(e);
              }());
            </script>

window.fbAsyninit=函数(){
FB.init({
appId:'XXXXXXXXXXXXXX',
cookie:true,//启用cookie以允许服务器访问会话
oauth:true,//oauth 2.0
状态:true,//检查登录状态
xfbml:true,//解析xfbml
channelUrl:document.location.protocol+'.//www.sitename.com/fbchannel.html'//自定义频道
});
//无论用户何时登录或注销,我们都会刷新页面
FB.Event.subscribe('auth.login',函数(响应){
window.location.reload();
警报(“登录”);
});
FB.Event.subscribe('auth.logout',函数(响应){
window.location.reload();
//警报(“注销”);
});
FB.getLoginStatus(函数(响应){
如果(response.status==“已连接”){
//用户已登录并连接到您的
//app和response.authResponse提供
//用户ID、有效访问令牌、签名
//请求,以及访问令牌的时间
//和签名的请求都将过期
var uid=response.authResponse.userID;
var accessToken=response.authResponse.accessToken;
//警报(“结束”);
//警报('名为'+unescape(window.location.pathname')的登录url);
//每当用户登录时,我们都会刷新页面
//警报(accessToken);
}else if(response.status=='not_authorized'){
//用户已登录到Facebook,
//但未连接到应用程序
}否则{
//该用户甚至没有登录到Facebook。
}
});
};
(功能(){
var e=document.createElement('script');
e、 src=document.location.protocol+'//connect.facebook.net/en_US/all.js';
e、 异步=真;
document.getElementById('fb-root').appendChild(e);
}());
在上面的东西下面的某个地方我有我的按钮

<fb:login-button scope="publish_stream,email" autologoutlink="true">Connect with FB</fb:login-button>
与FB连接

在花了几天的时间试图找出我遇到的问题后,问题终于解决了!谢谢chwk