使用facebook javascript不显示Oauth权限请求窗口

时间:2011-11-25 10:05:31

标签: facebook facebook-graph-api facebook-javascript-sdk facebook-oauth

我正在使用OAuth对话框在应用程序启动时收到用户电子邮件...所以在点击应用程序URL (https://apps.facebook.com/redirecttestapp/)而不是允许窗口时,我看到登录应用程序窗口,如果我点击登录然后我看到一个允许窗口..如何摆脱登录到应用程序窗口?这是代码:

<script>

     var href = "https://apps.facebook.com/redirecttestapp/";
        var appliId = "233664670032230";
      window.fbAsyncInit = function() {
        FB.init({
          appId      : '********', // App ID
          channelURL : '//apps.facebook.com/redirecttestapp/', // Channel File
          status     : true, // check login status
          cookie     : true, // enable cookies to allow the server to access the session
          oauth      : true, // enable OAuth 2.0
          xfbml      : true  // parse XFBML
        });

        // Additional initialization code here

              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
                alert("the user is logged in and connected to your app");
                var uid = response.authResponse.userID;
                var accessToken = response.authResponse.accessToken;
              } else if (response.status === 'not_authorized') {
                // the user is logged in to Facebook, 
                //but not connected to the app
                alert("the user is logged in to Facebook,but not connected to the app");
              } else {
                // the user isn't even logged in to Facebook.

               // alert("the user isn't even logged in to Facebook.");
                top.location.href = "https://www.facebook.com/dialog/oauth?client_id=233664670032230&redirect_uri="+href+'&display=page';
              }
            });
      };

      // Load the SDK Asynchronously
      (function(d){
         var js, id = 'facebook-jssdk'; if (d.getElementById(id)) {return;}
         js = d.createElement('script'); js.id = id; js.async = true;
         js.src = "//connect.facebook.net/en_US/all.js";
         d.getElementsByTagName('head')[0].appendChild(js);
       }(document));

    </script>

1 个答案:

答案 0 :(得分:0)

您是否启用了新的身份验证对话框? 检查您的应用设置

Why do I have two different permission get dialogues in Facebook API?