FB登录 - 授权弹出窗口打开2次

时间:2014-02-13 06:35:08

标签: javascript login facebook-javascript-sdk

如果我已经连接到fb,bt没有授权应用它打开弹出窗口2次...我尝试下面的代码...控制台没有错误....

   if (response.authResponse) {
       console.log("user is already logged in and connected");
       console.log("Fetching Info..... - already logged in");

       FB.api('/me', function(info) {
         login(response, info);
       });

       // button.onclick = function() {
       // FB.logout(function(response) {
       // logout(response);
       // });
       // };
   } else {
       console.log("user is not connected to your app or logged out");

       $('.login-with-fb-instant').click(function(e) {
         e.preventDefault();
         console.log("Fetching Info..... - logged out");
         $('.fb-loader').show();
         FB.login(function(response) {
           if (response.authResponse) {
             FB.api('/me', function(info) {
              login(response, info);
             });
           } else {
             console.log("user cancelled login or did not grant authorization");
             $('.fb-loader').hide();
           }
         }, {
             scope : 'email,user_birthday,status_update,publish_stream,user_about_me'
         });
      });
  }`enter code here`

0 个答案:

没有答案