메모
[페이스북] Graph API로 포스트 써주기.
네코냥이
2013. 11. 18. 11:08
1.
Facebook App 설정에서
Extended Permission 에 'publish_actions,publish_stream' 주기.
2.
로그인 시 권한 요청하기 (Extended 권한은 사용자에게 직접 Request을 해야하는 것으로 알고있다.)
FB.login(function(response) {
// handle the response
}, {scope: 'publish_actions,publish_stream'});
3.
포스트 날리기
var body = 'Reading JS SDK documentation';
FB.api('/me/feed', 'post', {
message: body,
access_token: FB.getAccessToken()
},
function(response) {
if (!response || response.error) {
alert('Error occured');
} else {
alert('Post ID: ' + response.id);
}
});
페이스 개발 문서들이 맨날 맨날 바뀐다.
쉬도 없이 바뀌므로, 미리 프린트하거나 pdf 형태로 저장해두자.
각각의 포스트 형태마다, 필수로 요청되는 value들 목록을 정리해둔 문서가 사라졌다.