Page 4 An Introduction To Facebook DevelopmentBeginning Facebook Development • Beginning with Facebook Development, you must know the following core concepts: Setup an new facebook ap
Trang 1An Pratical Approach to Social Network Platform
Revision: 1.00
Released: 2011/08/5
Author: PyCo13
Trang 2Page 2 An Introduction To Facebook Development
Trang 3THE FIRST LOOK TO SOCIAL NETWORK
Trang 4Page 4 An Introduction To Facebook Development
Beginning Facebook Development
• Beginning with Facebook Development, you must know the
following core concepts:
Setup an new facebook application.
Facebook authentication.
Graph API.
Open graph protocol.
Social plugins.
Trang 5Setup Facebook Development
Trang 6Page 6 An Introduction To Facebook Development
Setup Facebook Application
Steps to begin developing facebook application:
Validate your phone
Create Application
Configure Application
Get back application
parametersChoose right Facebook
SDK
Trang 7Validate your mobile phone
Validate your phone
http://www.facebook.com/update_security_info.ph
p
Trang 8Page 8 An Introduction To Facebook Development
Create facebook application
Validate your phone
Create Application
http://www.facebook.com/developers/createapp.ph
p
Trang 10Page 10 An Introduction To Facebook Development
Get back application’s parameters
Validate your phone
Trang 11Choose right facebook sdk
Validate your phone
Create ApplicationConfigure Application
Get back application
(http://code.google.com/p/facebook-• Java java-sdk/)
(http://code.google.com/p/facebook-The list is endless …
Trang 12Facebook Platform
Authentication
The Graph API
Facebook Query Language
Open Graph Protocol
Social Plugins
Trang 13Facebook Authentication
• Facebook Platform supports two different OAuth 2.0 flows for
user login:
server-side (know as the authentication code flow in the specification)
client-side (known as the implicit flow).
• Facebook’s implementation of the OAuth 2.0 involves three
different steps: user authentication, app authorization and app
authentication.
• http://developers.facebook.com/docs/authentication/permissions
/
Read Permissions: email, user_likes, user_photos, friends_events
Write Permission: publish_stream, create_event, offline_access
Page Permison: manage_pages
Trang 14Page 14 An Introduction To Facebook Development
Facebook Authentication
Trang 15Facebook Authentication – Server Side Flow
Trang 16Page 16 An Introduction To Facebook Development
Facebook Authentication – Client Side Flow
Trang 17The Graph API
• The Graph API provide interface for interacting with objects and connections in the
Facebook social graph.
• Every objects in social graph has a unique ID.
• The Graph API uses OAuth 2.0 for authorization - access_token .
Trang 18Page 18 An Introduction To Facebook Development
The Graph API
Trang 19The Graph API
Trang 20Page 20 An Introduction To Facebook Development
The Graph API
• Ex1: get basic user information
Trang 21The Graph API
• Ex2: select some field on your returned data
Trang 22Page 22 An Introduction To Facebook Development
The Graph API
• Ex3: get users friends list
Trang 23The Graph API
• Ex4: limit your query results
http://graph.facebook.com/kidhunter/? limit=3
{
"data": [
{"name": "Hung Le Thanh", "id": “12345678"},
{ “name": "Tuan Pham", "id": “12572288" }
Trang 24Page 24 An Introduction To Facebook Development
The Graph API
• Ex5: search people
Trang 25• Facebook Query Language
• Allows you to use a SQL-style interface to more easily query the
same Facebook social data that you can access through other Facebook API methods.
• Some key FQL Tables
Trang 26Page 26 An Introduction To Facebook Development
FQL
• Queries are of the form
• FROM clause can contain only a single table.
• can use the IN keyword in SELECT or WHERE clauses to do
subqueries, but subqueries cannot reference variables in the outer query's scope.
• Queries properties that are marked as indexable.
• FQL can handle simple math, basic boolean operators, AND or
NOT logical operators, and ORDER BY and LIMIT clauses.
SELECT [fields] FROM [table] WHERE [conditions]
Trang 27FQL
Trang 28Page 28 An Introduction To Facebook Development
Trang 29Open Graph Protocol
• The Open Graph Protocol enables you to integrate your Web
pages into the social graph.
• Including Open Graph tags on your Web page, makes your
page equivalent to a Facebook Page.
Trang 30Page 30 An Introduction To Facebook Development
Open Graph Protocol
• Facebook scrape our page:
every 24 hours
an admin for the Open Graph page clicks the Like button
URL is entered into the Facebook URL Linter
• Open graph protocol require four properties, two additional:
Trang 31Open Graph Protocol - Example
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:og="http://ogp.me/ns#"
xmlns:fb="http://www.facebook.com/2008/fbml">
<head>
<title>The Rock (1996)</title>
<meta property="og:title" content="The Rock"/>
<meta property="og:type" content="movie"/>
<meta property="og:url" content="http://www.imdb.com/title/tt0117500/"/>
<meta property="og:image" content="http://ia.media-imdb.com/rock.jpg"/>
<meta property="og:site_name" content="IMDb"/>
<meta property="fb:admins" content="USER_ID"/>
<meta property="og:description"
content="A group of U.S Marines, under command of
a renegade general, take over Alcatraz and
threaten San Francisco Bay with biological
Trang 32Page 32 An Introduction To Facebook Development
Social Plugins
Like Box
Registration Recommend
Comment
Trang 33Social Plugins
• Social plugins let you see what your friends have liked,
commented on or shared on sites across the web.
• Social plugins could be embed by using iFrame (<iframe>) or
Trang 34Page 34 An Introduction To Facebook Development
Trang 35Facebook Tools – Graph API Explorer
Trang 36Thank For Your Attention !