Facebook App Auth

时间:2012-08-13 18:05:08

标签: facebook facebook-javascript-sdk

我正在使用Facebook JavaScript SDK开发一个Web应用程序,以便在Facebook Canvas中显示。我的应用程序要求用户允许显示它的默认基本信息。但是当用户第一次尝试使用该应用程序时,它会询问EMAIL以及基本信息。作为Auth的一部分,我的应用程序不应向任何用户询问EMAIL权限。我使用下面的代码片段:

 window.fbAsyncInit = function()
{
    FB.init({ 
            appId: 'xxxxxxxxxxx',           //App Id
            //channelUrl:"",                    //Channel File
            status: true,                       //Check login status
            cookie: true,                       //Enable cookies to allow the server to access the session
            xfbml: true,                        //Parse XFBML
            oauth: false});                      //Enable OAuth


   //Show loader
   showLoader(true);

   //
   //update the button
   //
   function updateButton(response)
   {
        buttonFBLogin       =   document.getElementById('fb-auth');
        userInfo            =   document.getElementById('user-info');


        if (response && response.status == 'connected') //response.authResponse &&
        {
         // The user is connected to Facebook
         // and has authorized the app.
         // Now personalize the user experience

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

            buttonFBLogin.onclick = function()
            {
                FB.logout(function(response) {
                    logout(response);
                });
            };
        }
        else
        {
            //User is not connected to your app or logged out 
            buttonFBLogin.innerHTML = 'Login with Facebook';

            buttonFBLogin.onclick = function()
            {
                showLoader(true);

                FB.login(function(response)
                {
                    if (response.authResponse)
                    {
                        FB.api('/me', function(info)
                        {
                            login(response, info);
                        });
                    }
                    else
                    {
                        //
                        //user cancelled login or did not grant authorization
                        //
                        showLoader(false);
                    }
                    //
                    // Define the permissions you want from a user.
                    //
                }, {scope:'user_about_me'});//{scope:'email,status_update,publish_stream,user_about_me'});
            }
        }
    }

    // run once with current status and whenever the status changes
    FB.getLoginStatus(updateButton);
    FB.Event.subscribe('auth.statusChange', updateButton);
};

如何在App的Auth对话框中停止此EMAIL权限?

谢谢, DK

0 个答案:

没有答案