当我尝试向facebook发布动作时,我遇到了异常。
Exception :
{"error":{"message":"(#3502) Object at URL localhost/XXX has og:type of 'website'. The property 'myobject' requires an object of og:type 'mynamespace:myobject'. ","type":"OAuthException","code":3502}}
FB.api(
'/me/mynamespace:myaction',
'post',
{ myobject: url,
access_token: accessToken
},
function (response) {
if (!response || response.error) {
Alert(JSON.stringify(response));
}
});
我的网址来自后端的模型:
我的网址:http://localhost/post/og/
public ActionResult og(int id)
{
return View(new OGModel(id));
}
查看:
<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en-US"
xmlns:fb="https://www.facebook.com/2008/fbml">
<head prefix="og: http://ogp.me/ns# fb: http://ogp.me/ns/fb# @Model.NameSpace: http://ogp.me/ns/fb/@Model.NameSpace#">
<title>@Model.Title</title>
<meta property="fb:app_id" content="@Model.AppId" />
<meta property="og:type" content="@Model.NameSpace:myobject" />
<meta property="og:url" content="@Model.SharingLink">
<meta property="og:title" content="@Model.Title" />
<meta property="og:image" content="@Model.Image" />
</head>
<body>
<div>
</div>
</body>
</html>
有什么想法吗?
答案 0 :(得分:3)
您无法发布OG操作,其中对象URL位于localhost上,因为Facebook的抓取工具无法访问它们并读取元标记。 您需要从互联网访问所有对象的URL;特别是Facebook的爬虫。
检查Facebook在您的网址上检测到的内容(如果有)