2014-01-23 63 views
1

我想用下面的鏈接FPOR例子來展示使用graph api資料圖片:爲什麼使用圖形API獲取FB個人資料圖片需要訪問令牌?

https://graph.facebook.com/me/picture?redirect=0&height=200&type=normal&width=200 

我得到的迴應:

{ 
    "error": { 
     "message": "An active access token must be used to query information about the current user.", 
     "type": "OAuthException", 
     "code": 2500 
    } 
} 

凡在link他們說

由於個人資料照片始終在Facebook上公開,因此此電話 不需要任何訪問令牌。

回答

1

URI中的me只是一個佔位符,你需要把實際的Facebook user-id中,像你的鏈接頁面顯示的標題(/{user-id}/picture)。

例如:

https://graph.facebook.com/snoopdogg/picture?redirect=0&height=200&type=normal&width=200 

...返回如下:

{ 
    "data": { 
     "url": "https://fbcdn-profile-a.akamaihd.net/hprofile-ak-ash3/c11.0.433.433/s200x200/598452_10151897536239807_882122819_n.jpg", 
     "width": 200, 
     "height": 200, 
     "is_silhouette": false 
    } 
} 
+0

以前我記得 '我' 正在爲當前用戶 – Adham

+0

@Adham啊有趣。並且它不是一個錯誤,無論如何API會返回任何'user-id'(包括無效的)的錯誤? – admdrew

相關問題