[英]Facebook post custom action to timeline
I have created a custom action that I want to allow users to post to their timeline with eg {User} read {Article}. 我创建了一个自定义操作,我希望该操作允许用户使用{User}阅读{Article}的方式发布到其时间轴。 I can get this to work fine when I do a post using the sample URL like this : 当我使用示例网址进行发布时,我可以使其正常工作:
FB.api('/me/fbsite:actionname' +
'?object=http://samples.ogp.me/356694057772404&access_token=abc','post'
But when I replace the sample URL with my own URL I get the error 'The session was invalidated explicitly using an API call'. 但是,当我用自己的URL替换示例URL时,出现错误“使用API调用显式使会话无效”。 Can anybody please advise? 有人可以请教吗?
EDIT : Changed my Javascript to this, but I now get 'Invalid OAuth Access Token' : 编辑:更改为此,我的Java脚本,但现在我得到'无效的OAuth访问令牌':
<script type="text/javascript">
function redeem() {
FB.api('/me/fbsite:actionname' +
'?object=http://samples.ogp.me/356694057772404&access_token=\' + <%=UserManager.Current.FB.accessToken %> + \'', 'post',
function (response) {
var msg = 'Error occured';
if (!response || response.error) {
if (response.error) {
msg += "\n\nType: " + response.error.type + "\n\nMessage: " + response.error.message;
}
alert(msg);
}
else {
alert('Post was successful! Action ID: ' + response.id);
}
});
}
That might be because you are using the same access token in same session. 那可能是因为您在同一会话中使用了相同的访问令牌。 So try logging out and log back in, get a new FB access token, and try the query using the new access token you got, that should work as expected. 因此,尝试注销并重新登录,获取新的FB访问令牌,然后使用您获得的新访问令牌尝试查询,这应该可以正常工作。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.