Facebook graph api

9,608 views

Published on

Apresentação da nova Graph API do Facebook, esta que classifica e relaciona o conteúdo da rede social em forma de um grafo contendo objects e connections e seus correlacionamentos

0 Comments
2 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
9,608
On SlideShare
0
From Embeds
0
Number of Embeds
26
Actions
Shares
0
Downloads
73
Comments
0
Likes
2
Embeds 0
No embeds

No notes for slide

Facebook graph api

  1. 1. fagner moura - @seufagnergraph api
  2. 2. old REST(?) apihttps://api.facebook.com/method/[name]• users.hasAppPermission• users.isAppUser• users.getLoggedInUser• stream.publish ...
  3. 3. old REST(?) apihttps://api.facebook.com/method/[name]• users.hasAppPermission• users.isAppUser• users.getLoggedInUser• stream.publish ... session_key
  4. 4. old REST(?) apihttps://api.facebook.com/method/[name]• users.hasAppPermission• users.isAppUser• users.getLoggedInUser• stream.publish ... session_key
  5. 5. old REST(?) apihttps://api.facebook.com/method/[name]• users.hasAppPermission• users.isAppUser• users.getLoggedInUser• stream.publish ... session_key deprecated
  6. 6. old REST apihttps://api.facebook.com/method/[name]• users.hasAppPermission• users.isAppUser• users.getLoggedInUser• stream.publish ... session_key deprecated
  7. 7. old REST apihttps://api.facebook.com/method/[name]• users.hasAppPermission• users.isAppUser• users.getLoggedInUser• stream.publish ... session_key deprecated
  8. 8. REST ? • easy SOA • resources • only HTTP • stateless
  9. 9. • lightweight • simple • readablenow, only json response
  10. 10. objects
  11. 11. userpagemessagestatus messagephotovideo ... objects
  12. 12. userpagemessagestatus messagephotovideo ... objectshttps://graph.facebook.com/ID
  13. 13. userpagemessagestatus messagephotovideo ... objectshttps://graph.facebook.com/19292868552
  14. 14. userpagemessagestatus messagephotovideo ... objectshttps://graph.facebook.com/plataform
  15. 15. userpagemessagestatus messagephotovideo ... objects + connections
  16. 16. user@connections
  17. 17. homefeedpostsfriendspicturephotos ... user@connections
  18. 18. homefeedpostsfriends (public data)picturephotos ... user@connectionshttps://graph.facebook.com/me/friendshttps://graph.facebook.com/me/picture
  19. 19. homefeedpostsfriends (read_stream permission)picturephotos ... user@connectionshttps://graph.facebook.com/me/homehttps://graph.facebook.com/me/feed
  20. 20. homefeedpostsfriends (read_stream permission)picturephotos ... user@connections session_token?
  21. 21. homefeedpostsfriends (read_stream permission)picturephotos ... user@connections access_token
  22. 22. homefeedpostsfriends (user_photos permission)picturephotos ... user@connections access_token
  23. 23. • oauth 2.0 • server side • client sidegrantpermissions
  24. 24. • open protocol• authentication• widely used
  25. 25. • open protocol• authentication• widely used
  26. 26. • oauth 2.0 • server side • client sidegrantpermissions
  27. 27. • oauth server • user • applicationactors
  28. 28. server side flow App try to access OAuth Dialog Facebook (App Authorization) OAuth Dialog (User Authentication)curl -F client_id=113391995351148 -F redirect_uri=http://facebook-buraco-debug.jogatina.com..... https://www.facebook.com/dialog/oauth
  29. 29. server side flow App try to access OAuth Dialog Facebook (App Authorization) OAuth Dialog (User Authentication)curl -F client_id=113391995351148 -F redirect_uri=http://facebook-buraco-debug.jogatina.com..... -F scope=email, read_stream https://www.facebook.com/dialog/oauth
  30. 30. server side flow App try to access OAuth Dialog Facebook (App Authorization) OAuth Dialog (User Authentication)Cookie not found, show OAuth Dialog (facebook layout)
  31. 31. server side flow App try to access OAuth Dialog Facebook (App Authorization) OAuth Dialog (User Authentication)goes to App authorization directly
  32. 32. server side flow OAuth Dialog HTTP 302 (App Authorization) (redirect_url param)OAuth DialogUser Authentication) don´t allow ! redirect with some params like: error_reason, error, etc.
  33. 33. server side flow OAuth Dialog HTTP 302 (App Authorization) (redirect_url param)OAuth DialogUser Authentication) allow ! redirect with authorization code param
  34. 34. server side flow OAuth Dialog http://mydomain...) (App Authorization) curl -F client_id=113391995351148 -F redirect_uri=http://facebook-buraco-debug.jogatina.com..... -F client_secret=f8138690fe947221d4d2c071aa945395 -F code=[authorization code here] https://graph.facebook.com/oauth/access_token
  35. 35. server side flow http://mydomain... HTTP 400) { "error": { "type": "OAuthException", "message": "Error validating verification code." } }
  36. 36. server side flow HTTP 302 http://mydomain...) (redirect_url param) Sucessfull authenticated ! access_token in the body of the request
  37. 37. • oauth 2.0 • server side • client sidegrantpermissions
  38. 38. client side flow • desktop • mobile • javascript
  39. 39. client side flow OAuth Dialog HTTP request (App Authorization)curl -F client_id=113391995351148 -F redirect_uri=http://facebook-buraco-debug.jogatina.com..... -F ‘response_type=token https://www.facebook.com.br/dialog/oauth
  40. 40. client side flow HTTP 302 HTTP request (redirect_url param)Pass URI fragment with access_tokenhttp://jogatina.com....#access_token=gzZ666a..&expires_in=64090
  41. 41. client side flow HTTP request HTTP 400{ "error": { "type": "OAuthException", "message": "Error validating verification code." }}
  42. 42. services available • reading • searching • publishing • ...curl -F ‘fields=id,name,picture -F ‘access_token=... https://graph.facebook.com/fagner.moura
  43. 43. services available • reading • searching • publishing • ...curl -F ‘q=futebol -F ‘type=user https://graph.facebook.com/search
  44. 44. services available • reading • searching • publishing • ...curl -F ‘message=Jogue no Jogatina hoje -F ‘access_token=...’ https://graph.facebook.com/fagner.moura/feed
  45. 45. services available • reading • searching • publishing • ...paging deleting insights real time update
  46. 46. :-) fagner moura - @seufagner

×