2012-10-10 251 views
2

我在我的應用程序上做了一個動作「criar」和一個「oferta」對象。它回來了創建網頁的代碼是:OpenGraph不能正常工作

<head prefix="og: xttp://ogp.me/ns# fb: xttp://ogp.me/ns/fb# testegraph: xttp://ogp.me/ns/fb/testegraph#"> 
    <meta property="fb:app_id" content="186721904779529" /> 
    <meta property="og:type" content="testegraph:oferta" /> 
    <meta property="og:url" content="http://www.vendefacil.net:7979/mkt21manager/Welcome.jsf" /> 
    <meta property="og:title" content="Sample Oferta" /> 
    <meta property="og:image" content="https://s-static.ak.fbcdn.net/images/devsite/attachment_blank.png" /> 

(我把METAS用\代替<這樣他們就可以被讀取)

我嘗試了直接郵寄到OpenGraph與以下網址:

url = "https://graph.facebook.com/me/testegraph:criar?oferta=http://www.vendefacil.net:7979/mkt21manager/OpenGraph/oferta.html&access_token="+vc.getAccesstoken(); 

結果是:

HTTP/1.1 400 Bad Request [Access-Control-Allow-Origin: *, Cache-Control: no-store, Content-Type: text/javascript; charset=UTF-8, Expires: Sat, 01 Jan 2000 00:00:00 GMT, Pragma: no-cache, WWW-Authenticate: OAuth "Facebook Platform" "invalid_request" "(#3502) Object at URL http://www.vendefacil.net:7979/mkt21manager/OpenGraph/oferta.html has og:type of 'website'. The property 'oferta' requires an object of og:type 'testegraph:oferta'. ", X-FB-Rev: 644018, X-FB-Debug: Kvtoba9EGskocz2wxI7T2iXvfzV8SvjdxNNzuYfSCp8=, Date: Wed, 10 Oct 2012 16:33:15 GMT, Connection: keep-alive, Content-Length: 252] 

好像是抱怨ABO所提供的網站沒有testegraph:oferta作爲og:類型,我知道這是在給定的網站。那麼,什麼是錯的?

回答

0

根據Facebook's Debug Tool您的應用程序將立即302重定向到 302 https://www.facebook.com/dialog/oauth?client_id=153701288088609&redirect_uri=http://www.vendefacil.net:7979/mkt21manager/Welcome.jsf&scope=email,user_photos,user_location,user_groups,status_update&response_type=code

履帶遵循重定向,但不會刮facebook.com網址,方便你的頁面中的信息不能被更新。

您需要從重定向免除Facebook的履帶和提供正確的meta標籤

+0

好吧,我看到了這個問題,並使用一個簡單的網站,如「http://www.google.com」嘗試而不是「HTTP ://www.vendefacil.net:7979/mkt21manager/Welcome.jsf」。調試時仍然有警告:推斷的屬性:\t應該明確提供'og:url'屬性,即使可以從其他標記中推斷出值。 推斷的屬性:\t即使可以從其他標籤推斷出值,也應明確提供'og:title'屬性。 –

+0

是的,Google.com沒有開放圖形元標籤。 你需要你的URL來爲facebook抓取工具提供正確的標籤。 – Igy

+0

我解決了這個頁面,現在它在Debug上正常工作。問題是我不能使用我的調試應用程序來調試這個程序,直接在發佈版本上測試它,因爲它不會在我的本地主機上尋找頁面。無論如何,我將在一分鐘內測試它,看看正確的頁面是否仍然保持相同的錯誤... –