我使用的JavaScript API張貼圖片至Facebook圖片文章給出錯誤
$.ajax({
type : "POST",
url : "https://graph.facebook.com/me/photos",
data : {
message : "Good One",
url : photoUrl,// URL of Image to post on facebook ,e.g https://si0.twimg.com/profile_images/2642324404/46d743534606515238a9a12cfb4b264a.jpeg
access_token : getCookie("fbTocken"),//this is the access tocken which i got frome facebook ,saved it in cookies which I am fetching
format : "json"
},
success : function(data) {
alert("POST SUCCESSFUL");
}
)}
一切工作正常,問題是,當我改變
photourl
爲localhost圖像URL像http://localhost:8980/xcloud/resources/images/logo.png
Facebook的回報錯誤
{
"error": {
"message": "An unknown error has occurred.",
"type": "OAuthException",
"code": 1
}
}
個
其他正常的網址,我可以張貼到Facebook和工作正常
(項目是用java Tomcat作爲服務器)
當你在cookie中保存訪問tokan時,確保你真的使用XSS安全,如果黑客竊取cookie,他可以發佈用戶facebook。 – Ata
確定感謝您的建議將做到這一點 – nimbhu