콘테스트 및 프로모션 관련 Facebook 앱을 개발하는 중이며 내 앱 페이지에 내 앱의 액세스 권한을 제공하는 탭을 만들려고합니다.Facebook 확장 된 권한이 필요합니다 : publish_actions
일단 사용자는 현지 기업을 수상자로 지명 할 수 있습니다. 나중에; 후보가 나오면 사용자는 당첨자를 투표 할 수 있습니다. 내가 개체 유형 (Organization
), 행동 유형 (Nominate
, Vote For
)을 활용하고, 집계 (Nominations
) 할 수 있도록
나는 내 애플 리케이션에 오픈 그래프를 통합했습니다. 내 주요 목표는 다음 사용자의 타임 라인에 이러한 작업을 전송하는 것입니다.
레시피 박스 예제를 기반으로 사용했습니다. 액션 유형/객체 유형 조합을 제출하는 데 필요한 인증 및 게시 조치를 설명하기 위해 코드를 제공했습니다.
<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en-US">
<head prefix="og: http://ogp.me/ns# og_<<app namespace>>: http://ogp.me/ns/apps/<<app namespace>>#">
<meta property="fb:app_id" content="<<app id>>" />
<meta property="og:type" content="<<app namespace>>:organization" />
<meta property="og:title" content="Client 1" />
<meta property="og:image" content="<<client image path>>" />
<meta property="og:description" content="Client 1 description here ... " />
<meta property="og:url" content="<<custom client URL>>">
<script src="http://connect.facebook.net/en_US/all.js"></script>
<script type="text/javascript">
// 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));
// Init the SDK upon load
window.fbAsyncInit = function() {
FB.init({
appId : '<<app id>>', // App ID
status : true, // check login status
cookie : true, // enable cookies to allow the server to access the session
xfbml : true // parse XFBML
});
// listen for and handle auth.statusChange events
FB.Event.subscribe('auth.statusChange', function(response) {
if (response.authResponse) {
// user has auth'd your app and is logged into Facebook
FB.api('/me', function(me){
if (me.name) {
document.getElementById('auth-displayname').innerHTML = me.name;
}
})
document.getElementById('auth-loggedout').style.display = 'none';
document.getElementById('auth-loggedin').style.display = 'block';
} else {
// user has not auth'd your app, or is not logged into Facebook
document.getElementById('auth-loggedout').style.display = 'block';
document.getElementById('auth-loggedin').style.display = 'none';
}
});
// respond to clicks on the login and logout links
document.getElementById('auth-loginlink').addEventListener('click', function(){
FB.login();
});
document.getElementById('auth-logoutlink').addEventListener('click', function(){
FB.logout();
});
}
function nominate() {
FB.api('/me/<<app namespace>>:Nominate&organization=<<custom client URL>>', 'post', function(response) {
if (! response || response.error) {
alert('Error occured');
console.log(response);
} else {
alert('Post was successful! Action ID: ' + response.id);
}
});
}
</script>
</head>
<body>
<div id="fb-root"></div>
<div id="auth-status">
<div id="auth-loggedout">
<a href="#" id="auth-loginlink">Login</a>
</div>
<div id="auth-loggedin" style="display:none">
Hi, <span id="auth-displayname"></span>
(<a href="#" id="auth-logoutlink">logout</a>)
</div>
</div>
<h2>Client 1</h2>
<form>
<input type="button" value="Nominate" onclick="nominate()" />
</form>
<fb:activity actions="<<app namespace>>:nominate"></fb:activity>
</body>
</html>
테스트 사용자가 다음과 같은 오류가 발생한다 :
This method must be called with an app access_token
첫 번째 오류 :
Requires extended permission: publish_actions
을 그리고 나는 다음과 같은 오류가 발생하고 (나는이 응용 프로그램에 대한 관리자입니다) 나에게 문제가있다. Apps | <My App> | Permissions | Extended Permissions
에서 publish_actions
을 선택할 수 없습니다. 또한 내가 만난 구제책은 내 앱을 Games
(이 기능은 작동하지 않음)으로 다시 분류하고 집계를 완료하는 것입니다 (여전히했으나 작동하지 않음).
- 이 오류를 어떻게 극복 할 수 있습니까?
- 무엇을 할 수 있습니까?
This method must be called with an app access_token
오류가 있습니까? 나는 발생 된access_token
오류를 생각사전에
감사합니다,
마이크
편집 내가이 앱에 직접 상호 작용/테스트 있다는 사실 때문 페이지 탭 URL; 페이스 북을 통해서가 아니다.
더 이상 Requires extended permission: publish_actions error
을받지 못했습니다. 그러나 테스터와 개발자는 있습니다. publish_actions 권한이 초기 facebook.com 로그인 프롬프트에서 요청되지 않았기 때문에이 오류가 발생한다는 것을 알고 있습니다.
내 개발자/페이스 북의 로그 아웃 테스터, 그럼 내 프롬프트에 다시 로그인하는 경우 :
FB.login(function (response) { }, { scope:'publish_actions'});
그런 다음이 권한 및 응용 프로그램은 자신의 페이스 북 세션에 통합되어 있습니다. 내 마지막 질문은 페이스 북에 로그인/로그 아웃하지 않고이 권한을 요청하는 기본 방법입니다.
나는'scope' 매개 변수없이'FB.login()'을 호출하는 것을 볼 수 있습니다 - 실제로'publish_actions' 권한이 실제로 부여되기를 기대하십니까? – CBroe