Facebook Javascript SDK父级和弹出式页面都在Facebook登录页面重定向

时间:2012-10-24 01:19:00

标签: ruby-on-rails facebook ruby-on-rails-3 facebook-javascript-sdk

Here is the print screen of my problem

我的facebook Javascript SDK有问题....它正在运行但是。当你点击登录...会有一个弹出式节目,你在Facebook上签名(这是可以的)..问题是,当你登录弹出登录窗口时不要关闭它股票那里......第二个问题是,父页面也重定向到Facebook登录页面..我该如何解决? 顺便说一下,我在轨道上使用红宝石。

Heres my facebook.js:

window.fbAsyncInit = function() {
  FB.init({
    appId      : "XXXXXXXXXXXXXXXX", // App ID
    status     : true, // check login status
    cookie     : true, // enable cookies to allow the server to access the session
    xfbml      : true  // parse XFBML

  });


    $(function() {
      $("#signin").click(function() {
        FB.login(function(response, event) {
           if (response.authResponse) {
             $.cookie("user_id", response.authResponse.userID);
             $.cookie("access_token", response.authResponse.accessToken);
             window.location = "#{auth_facebook_callback_url}";
          } else {
          }
        }, {scope: 'email,read_stream,publish_stream,offline_access'});
      });
    });


    $(function() {
        $("#signout").click(function(){
            FB.getLoginStatus(function(response){
                if(response.authResponse){
                    FB.logout();
                }
            });
        });
    }); 
 };
// Load the SDK Asynchronously
(function(d){
   var js, id = 'facebook-jssdk', ref = d.getElementsByTagName('script')[0];
   if (d.getElementById(id)) {return;}
   js = d.createElement('script'); js.id = id; js.async = true;
   js.src = '//connect.facebook.net/en_US/all.js';
   ref.parentNode.insertBefore(js, ref);
 }(document));

提前致谢:)

1 个答案:

答案 0 :(得分:0)

我认为你需要提供 redirect_uri 此处描述的参数(您还指定范围): https://developers.facebook.com/docs/reference/dialogs/oauth/