2013-10-13 3 views
0

다음 코드를 사용하여 Facebook에 성공적으로 연결하는 Facebook과의 개인지도를 따릅니다.Facebook에서 publish_actions 권한을 얻는 방법

코드는 다음 -

FB.Event.subscribe('auth.authResponseChange', function (response) { 
       if (response.status === 'connected') { 
        // the user is logged in and has authenticated 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; 

        // TODO: Handle the access token 

        // Do a post to the server to finish the logon 
        // This is a form post since we don't want to use AJAX 
        var form = document.createElement("form"); 
        form.setAttribute("method", 'post'); 
        form.setAttribute("action", 'loadMainPage.ashx'); 

        var field = document.createElement("input"); 
        field.setAttribute("type", "hidden"); 
        field.setAttribute("name", 'accessToken'); 
        field.setAttribute("value", accessToken); 
        form.appendChild(field); 

        document.body.appendChild(form); 
        form.submit(); 

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

     }; 

어떻게 publish_actions 권한을 요청할 수 있습니다?

답변

0

어떤 플랫폼을 사용하고 있습니까? Facebook's official docs을 참조하십시오.

발췌 :

요청 권한

는 이러한 권한을 요청하는 자신의 방법은 로그인 흐름의 각 유형이있다 : 자바 스크립트 SDK와

  • 웹 로그인 범위를 사용합니다 옵션을 FB.login 함수 호출과 함 2 사용하십시오.
  • 웹 로그인의 다른 유형은 리디렉션 할 로그인 대화 URL에 범위 매개 변수를 추가해야합니다.
  • Android 로그인은 LoginButton 클래스에서 setReadPermissions 및 setPublishPermissions 을 사용합니다.
  • iOS 로그인은 FBLoginView 클래스의 readPermissions 및 publishPermissions 속성 을 사용합니다.
관련 문제