SlideShare a Scribd company logo
1 of 28
Download to read offline
Facebook Login & Open Graph
王致平(Eric Ping)
多奇數位創意有限公司
(本範例使用 Facebook Graph API v2.3)
Contents
Facebook API
Oauth
Facebook Login (Website)
Facebook Login (Server)
Exchange Access Token
Open Graph
What's API?
The Library offered by OS or Third Party to do something
What's Facebook API
Website & Application can get user data from Facebook
What's OAuth
Log in different application by same service
Facebook Login (Website)
Users can log in your website by Facebook
You can get user data over Facebook API
How to Implement
Facebook Login
Add a New App
App ID
App Secret
Website URL
ex: http://sudo.tw
Mobile URL
ex: http://m.sudo.tw
Facebook Login
(Browser)
Short-Lived Token
(about 2 hours)
For security reason, please send the accessToken back to
your Server and request a new accessToken from Server
directly in order to protect your accessToken leaked from
the Client-side.
Facebook Login
(Request From Your Server)
Redirect To FB Login URL
(HTTP 302)
https://www.facebook.com/dialog/oauth?
client_id={APP-ID}&
redirect_uri={REDIRECT-URI}
After Login Success
{REDIRECT-URI}?code={CODE}
CODE is the one time token in order to get the real
AccessToken
Request For AccessToken
Request from your server
GET https://graph.facebook.com/oauth/access_token?
client_id={APP-ID}
&redirect_uri={REDIRECT-URI}
&client_secret={APP-SECRET}
&code={CODE}
Request For AccessToken
Response Body
access_token={ACCESS-TOKEN}&expires={EXPIRE-SECOND}
(P.S. the CODE will be expired after requesting the AccessToken,
please remember this AccessToken)
If you request it again from your
server with the same parameter…
Response Body
Hey, It’s JSON Format
Request For Long-Lived
AccessToken
Request from your server
GET https://graph.facebook.com/oauth/access_token?
grant_type=fb_exchange_token
&client_id={APP-ID}
&redirect_uri={REDIRECT-URI}
&client_secret={APP-SECRET}
&fb_exchange_token={ACCESS-TOKEN}
Request For Long-Lived
AccessToken
Response Body
access_token={ACCESS-TOKEN}&expires={EXPIRE-SECOND}
Check Token is valid or not
Send any graph API request.
If failed, please follow this
https://developers.facebook.com/blog/post/2011/05/13/ho
w-to--handle-expired-access-tokens/
Image via from Facebook
Short-Lived
(about 2 hours)
Long-Lived
(about 60 days)
Open Graph
http://ogp.me/
Make your website shared to facebook richer
Share Your Page to Facebook
Facebook Robot will read Metadata
og:image or og:video og:title
og:description
author
Set Your Open Graph
Q & A
Some Link
Facebook Developers https://developers.facebook.com/
Facebook Access Tokens https://developers.facebook.com/docs/facebook-
login/access-tokens
The Open Graph protocol http://ogp.me/
Example Project https://github.com/EricPing/NodeJsFacebookExamle

More Related Content

What's hot

Using ArcGIS with OAuth 2.0 - Esri DevSummit Dubai 2013
Using ArcGIS with OAuth 2.0 - Esri DevSummit Dubai 2013Using ArcGIS with OAuth 2.0 - Esri DevSummit Dubai 2013
Using ArcGIS with OAuth 2.0 - Esri DevSummit Dubai 2013
Aaron Parecki
 
ASA RA VPN with AD Authentication
ASA RA VPN with AD AuthenticationASA RA VPN with AD Authentication
ASA RA VPN with AD Authentication
dirflash
 

What's hot (20)

Webhooks
WebhooksWebhooks
Webhooks
 
Introduction to OAuth 2.0 - Part 2
Introduction to OAuth 2.0 - Part 2Introduction to OAuth 2.0 - Part 2
Introduction to OAuth 2.0 - Part 2
 
How to register your application to authorize o365 graph api
How to register your application to authorize o365 graph apiHow to register your application to authorize o365 graph api
How to register your application to authorize o365 graph api
 
Using ArcGIS with OAuth 2.0 - Esri DevSummit Dubai 2013
Using ArcGIS with OAuth 2.0 - Esri DevSummit Dubai 2013Using ArcGIS with OAuth 2.0 - Esri DevSummit Dubai 2013
Using ArcGIS with OAuth 2.0 - Esri DevSummit Dubai 2013
 
CIS 2015- SSO for Mobile and Web Apps- Ashish Jain
CIS 2015- SSO for Mobile and Web Apps- Ashish JainCIS 2015- SSO for Mobile and Web Apps- Ashish Jain
CIS 2015- SSO for Mobile and Web Apps- Ashish Jain
 
OAuth Android Göteborg
OAuth Android GöteborgOAuth Android Göteborg
OAuth Android Göteborg
 
Integrate with linked in
Integrate with linked inIntegrate with linked in
Integrate with linked in
 
Client-Server
Client-ServerClient-Server
Client-Server
 
OAuth2 Authentication
OAuth2 AuthenticationOAuth2 Authentication
OAuth2 Authentication
 
Integration with microsoft share point
Integration with microsoft share pointIntegration with microsoft share point
Integration with microsoft share point
 
Microsoft identity manoj mittal
Microsoft identity manoj mittalMicrosoft identity manoj mittal
Microsoft identity manoj mittal
 
Linkedin OAuth for curious people
Linkedin OAuth for curious peopleLinkedin OAuth for curious people
Linkedin OAuth for curious people
 
#Instagram API Get visibility you always wanted
#Instagram API   Get visibility you always wanted#Instagram API   Get visibility you always wanted
#Instagram API Get visibility you always wanted
 
Bulk sms gateway integration in java
Bulk sms gateway integration in javaBulk sms gateway integration in java
Bulk sms gateway integration in java
 
Rest security in mule
Rest security in muleRest security in mule
Rest security in mule
 
Mule integration with linkedin
Mule integration with linkedinMule integration with linkedin
Mule integration with linkedin
 
Internet Explorer and Outlook Express
Internet  Explorer and Outlook ExpressInternet  Explorer and Outlook Express
Internet Explorer and Outlook Express
 
How to integrate bulk sms api in java
How to integrate bulk sms api in javaHow to integrate bulk sms api in java
How to integrate bulk sms api in java
 
How To Use the Atomic App For Chrome
How To Use the Atomic App For ChromeHow To Use the Atomic App For Chrome
How To Use the Atomic App For Chrome
 
ASA RA VPN with AD Authentication
ASA RA VPN with AD AuthenticationASA RA VPN with AD Authentication
ASA RA VPN with AD Authentication
 

Viewers also liked

Pemanfaatan json dengan mysql
Pemanfaatan json dengan mysqlPemanfaatan json dengan mysql
Pemanfaatan json dengan mysql
DermawanAdi
 
Membangun Aplikasi SMS dengan Gammu dan PHP Framework CodeIgniter
Membangun Aplikasi SMS dengan Gammu dan PHP Framework CodeIgniterMembangun Aplikasi SMS dengan Gammu dan PHP Framework CodeIgniter
Membangun Aplikasi SMS dengan Gammu dan PHP Framework CodeIgniter
Beni Krisbiantoro
 

Viewers also liked (20)

Facebook graph api
Facebook graph apiFacebook graph api
Facebook graph api
 
什麼是PHP & JavaScript
什麼是PHP & JavaScript什麼是PHP & JavaScript
什麼是PHP & JavaScript
 
Facebook Connect in 3 Hours
Facebook Connect in 3 HoursFacebook Connect in 3 Hours
Facebook Connect in 3 Hours
 
Facebook Connect Presentation 08 10 2008
Facebook Connect Presentation 08 10 2008Facebook Connect Presentation 08 10 2008
Facebook Connect Presentation 08 10 2008
 
Facebook Connect
Facebook ConnectFacebook Connect
Facebook Connect
 
Facebook Connect For Your 
Website
Facebook Connect For Your 
WebsiteFacebook Connect For Your 
Website
Facebook Connect For Your 
Website
 
Facebook Connect
Facebook ConnectFacebook Connect
Facebook Connect
 
Facebook Connect Tutorial
Facebook Connect TutorialFacebook Connect Tutorial
Facebook Connect Tutorial
 
Facebook Login and Open Graph
Facebook Login and Open GraphFacebook Login and Open Graph
Facebook Login and Open Graph
 
Pemanfaatan json dengan mysql
Pemanfaatan json dengan mysqlPemanfaatan json dengan mysql
Pemanfaatan json dengan mysql
 
Pengenalan json
Pengenalan jsonPengenalan json
Pengenalan json
 
Membangun Aplikasi SMS dengan Gammu dan PHP Framework CodeIgniter
Membangun Aplikasi SMS dengan Gammu dan PHP Framework CodeIgniterMembangun Aplikasi SMS dengan Gammu dan PHP Framework CodeIgniter
Membangun Aplikasi SMS dengan Gammu dan PHP Framework CodeIgniter
 
Web api
Web api Web api
Web api
 
Facebook Connect
Facebook ConnectFacebook Connect
Facebook Connect
 
The Introductory Guide to Social Login
The Introductory Guide to Social LoginThe Introductory Guide to Social Login
The Introductory Guide to Social Login
 
Web API Practice Handbook
Web API Practice HandbookWeb API Practice Handbook
Web API Practice Handbook
 
Facebook Open Stream API - Facebook Developer Garage Dhaka
Facebook Open Stream API - Facebook Developer Garage DhakaFacebook Open Stream API - Facebook Developer Garage Dhaka
Facebook Open Stream API - Facebook Developer Garage Dhaka
 
Analysis of 150 Websites Using Facebook Login
Analysis of 150 Websites Using Facebook LoginAnalysis of 150 Websites Using Facebook Login
Analysis of 150 Websites Using Facebook Login
 
Pengembangan Mobile Learning (Android) dengan eXeLearning dan PhoneGap Build
Pengembangan Mobile Learning (Android) dengan eXeLearning dan PhoneGap BuildPengembangan Mobile Learning (Android) dengan eXeLearning dan PhoneGap Build
Pengembangan Mobile Learning (Android) dengan eXeLearning dan PhoneGap Build
 
"Introduction Open Graph and Facebook Platform" - Facebook Developer Garage ...
"Introduction Open Graph and Facebook Platform" -  Facebook Developer Garage ..."Introduction Open Graph and Facebook Platform" -  Facebook Developer Garage ...
"Introduction Open Graph and Facebook Platform" - Facebook Developer Garage ...
 

Similar to Facebook Login & Open Graph Introduction

OAuth Introduction
OAuth IntroductionOAuth Introduction
OAuth Introduction
h_marvin
 
Facebook API
Facebook APIFacebook API
Facebook API
snipermkd
 
Erikeldridge Yos V9
Erikeldridge Yos V9Erikeldridge Yos V9
Erikeldridge Yos V9
JH Lee
 
SPTECHCON - Who are You and What Do You Want - Working with OAuth in SharePoi...
SPTECHCON - Who are You and What Do You Want - Working with OAuth in SharePoi...SPTECHCON - Who are You and What Do You Want - Working with OAuth in SharePoi...
SPTECHCON - Who are You and What Do You Want - Working with OAuth in SharePoi...
Eric Shupps
 
Hack u iitb_social
Hack u iitb_socialHack u iitb_social
Hack u iitb_social
Rajesh Kumar
 
Programming With Amazon, Google, And E Bay
Programming With Amazon, Google, And E BayProgramming With Amazon, Google, And E Bay
Programming With Amazon, Google, And E Bay
Phi Jack
 
DevCon 2010 - Facebook Apps development for ASP.NET devs
DevCon 2010 - Facebook Apps development  for ASP.NET devsDevCon 2010 - Facebook Apps development  for ASP.NET devs
DevCon 2010 - Facebook Apps development for ASP.NET devs
Krishna T
 

Similar to Facebook Login & Open Graph Introduction (20)

OAuth Introduction
OAuth IntroductionOAuth Introduction
OAuth Introduction
 
Facebook api
Facebook api Facebook api
Facebook api
 
Facebook API
Facebook APIFacebook API
Facebook API
 
Facebook + Ruby
Facebook + RubyFacebook + Ruby
Facebook + Ruby
 
Share point 2013 add-in (formerly app) development
Share point 2013 add-in (formerly app) developmentShare point 2013 add-in (formerly app) development
Share point 2013 add-in (formerly app) development
 
Devteach 2017 OAuth and Open id connect demystified
Devteach 2017 OAuth and Open id connect demystifiedDevteach 2017 OAuth and Open id connect demystified
Devteach 2017 OAuth and Open id connect demystified
 
Erikeldridge Yos V9
Erikeldridge Yos V9Erikeldridge Yos V9
Erikeldridge Yos V9
 
Hands-on with OAuth, Facebook and the Force.com Platform
Hands-on with OAuth, Facebook and the Force.com PlatformHands-on with OAuth, Facebook and the Force.com Platform
Hands-on with OAuth, Facebook and the Force.com Platform
 
Oauth
OauthOauth
Oauth
 
Who Are You and What Do You Want? Working with OAuth in SharePoint 2013.
Who Are You and What Do You Want? Working with OAuth in SharePoint 2013.Who Are You and What Do You Want? Working with OAuth in SharePoint 2013.
Who Are You and What Do You Want? Working with OAuth in SharePoint 2013.
 
Easy Way To Make Facebook Account Backdoor Without Scripting
Easy Way To Make Facebook Account Backdoor Without ScriptingEasy Way To Make Facebook Account Backdoor Without Scripting
Easy Way To Make Facebook Account Backdoor Without Scripting
 
SPTECHCON - Who are You and What Do You Want - Working with OAuth in SharePoi...
SPTECHCON - Who are You and What Do You Want - Working with OAuth in SharePoi...SPTECHCON - Who are You and What Do You Want - Working with OAuth in SharePoi...
SPTECHCON - Who are You and What Do You Want - Working with OAuth in SharePoi...
 
Hack u iitb_social
Hack u iitb_socialHack u iitb_social
Hack u iitb_social
 
OAuth 2.0 and OpenID Connect
OAuth 2.0 and OpenID ConnectOAuth 2.0 and OpenID Connect
OAuth 2.0 and OpenID Connect
 
Forge - DevCon 2016: Building Value-Added Integrations with Autodesk’s IoT APIs
Forge - DevCon 2016: Building Value-Added Integrations with Autodesk’s IoT APIsForge - DevCon 2016: Building Value-Added Integrations with Autodesk’s IoT APIs
Forge - DevCon 2016: Building Value-Added Integrations with Autodesk’s IoT APIs
 
Programming With Amazon, Google, And E Bay
Programming With Amazon, Google, And E BayProgramming With Amazon, Google, And E Bay
Programming With Amazon, Google, And E Bay
 
DevCon 2010 - Facebook Apps development for ASP.NET devs
DevCon 2010 - Facebook Apps development  for ASP.NET devsDevCon 2010 - Facebook Apps development  for ASP.NET devs
DevCon 2010 - Facebook Apps development for ASP.NET devs
 
Microsoft Graph API with OutSystems Event Subscriptions
Microsoft Graph API with OutSystems Event SubscriptionsMicrosoft Graph API with OutSystems Event Subscriptions
Microsoft Graph API with OutSystems Event Subscriptions
 
OAuth in the Wild
OAuth in the WildOAuth in the Wild
OAuth in the Wild
 
Api security with OAuth
Api security with OAuthApi security with OAuth
Api security with OAuth
 

More from Eric Ping (6)

Git Basics
Git BasicsGit Basics
Git Basics
 
ASP.NET MVC Identity 介紹
ASP.NET MVC Identity 介紹ASP.NET MVC Identity 介紹
ASP.NET MVC Identity 介紹
 
ASP.NET MVC 開發分享
ASP.NET MVC 開發分享ASP.NET MVC 開發分享
ASP.NET MVC 開發分享
 
Android 開發學習 (1)
Android 開發學習 (1)Android 開發學習 (1)
Android 開發學習 (1)
 
Css3 介紹
Css3 介紹Css3 介紹
Css3 介紹
 
Android 第一次開發 心得
Android 第一次開發 心得Android 第一次開發 心得
Android 第一次開發 心得
 

Recently uploaded

Integrated Test Rig For HTFE-25 - Neometrix
Integrated Test Rig For HTFE-25 - NeometrixIntegrated Test Rig For HTFE-25 - Neometrix
Integrated Test Rig For HTFE-25 - Neometrix
Neometrix_Engineering_Pvt_Ltd
 
Standard vs Custom Battery Packs - Decoding the Power Play
Standard vs Custom Battery Packs - Decoding the Power PlayStandard vs Custom Battery Packs - Decoding the Power Play
Standard vs Custom Battery Packs - Decoding the Power Play
Epec Engineered Technologies
 
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
ssuser89054b
 
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak HamilCara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Kandungan 087776558899
 
DeepFakes presentation : brief idea of DeepFakes
DeepFakes presentation : brief idea of DeepFakesDeepFakes presentation : brief idea of DeepFakes
DeepFakes presentation : brief idea of DeepFakes
MayuraD1
 
"Lesotho Leaps Forward: A Chronicle of Transformative Developments"
"Lesotho Leaps Forward: A Chronicle of Transformative Developments""Lesotho Leaps Forward: A Chronicle of Transformative Developments"
"Lesotho Leaps Forward: A Chronicle of Transformative Developments"
mphochane1998
 

Recently uploaded (20)

Integrated Test Rig For HTFE-25 - Neometrix
Integrated Test Rig For HTFE-25 - NeometrixIntegrated Test Rig For HTFE-25 - Neometrix
Integrated Test Rig For HTFE-25 - Neometrix
 
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
 
Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...
Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...
Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...
 
Unit 4_Part 1 CSE2001 Exception Handling and Function Template and Class Temp...
Unit 4_Part 1 CSE2001 Exception Handling and Function Template and Class Temp...Unit 4_Part 1 CSE2001 Exception Handling and Function Template and Class Temp...
Unit 4_Part 1 CSE2001 Exception Handling and Function Template and Class Temp...
 
Computer Networks Basics of Network Devices
Computer Networks  Basics of Network DevicesComputer Networks  Basics of Network Devices
Computer Networks Basics of Network Devices
 
Block diagram reduction techniques in control systems.ppt
Block diagram reduction techniques in control systems.pptBlock diagram reduction techniques in control systems.ppt
Block diagram reduction techniques in control systems.ppt
 
Standard vs Custom Battery Packs - Decoding the Power Play
Standard vs Custom Battery Packs - Decoding the Power PlayStandard vs Custom Battery Packs - Decoding the Power Play
Standard vs Custom Battery Packs - Decoding the Power Play
 
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
 
COST-EFFETIVE and Energy Efficient BUILDINGS ptx
COST-EFFETIVE  and Energy Efficient BUILDINGS ptxCOST-EFFETIVE  and Energy Efficient BUILDINGS ptx
COST-EFFETIVE and Energy Efficient BUILDINGS ptx
 
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak HamilCara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
 
GEAR TRAIN- BASIC CONCEPTS AND WORKING PRINCIPLE
GEAR TRAIN- BASIC CONCEPTS AND WORKING PRINCIPLEGEAR TRAIN- BASIC CONCEPTS AND WORKING PRINCIPLE
GEAR TRAIN- BASIC CONCEPTS AND WORKING PRINCIPLE
 
AIRCANVAS[1].pdf mini project for btech students
AIRCANVAS[1].pdf mini project for btech studentsAIRCANVAS[1].pdf mini project for btech students
AIRCANVAS[1].pdf mini project for btech students
 
Design For Accessibility: Getting it right from the start
Design For Accessibility: Getting it right from the startDesign For Accessibility: Getting it right from the start
Design For Accessibility: Getting it right from the start
 
Moment Distribution Method For Btech Civil
Moment Distribution Method For Btech CivilMoment Distribution Method For Btech Civil
Moment Distribution Method For Btech Civil
 
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptx
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptxS1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptx
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptx
 
Online food ordering system project report.pdf
Online food ordering system project report.pdfOnline food ordering system project report.pdf
Online food ordering system project report.pdf
 
Work-Permit-Receiver-in-Saudi-Aramco.pptx
Work-Permit-Receiver-in-Saudi-Aramco.pptxWork-Permit-Receiver-in-Saudi-Aramco.pptx
Work-Permit-Receiver-in-Saudi-Aramco.pptx
 
DeepFakes presentation : brief idea of DeepFakes
DeepFakes presentation : brief idea of DeepFakesDeepFakes presentation : brief idea of DeepFakes
DeepFakes presentation : brief idea of DeepFakes
 
Hostel management system project report..pdf
Hostel management system project report..pdfHostel management system project report..pdf
Hostel management system project report..pdf
 
"Lesotho Leaps Forward: A Chronicle of Transformative Developments"
"Lesotho Leaps Forward: A Chronicle of Transformative Developments""Lesotho Leaps Forward: A Chronicle of Transformative Developments"
"Lesotho Leaps Forward: A Chronicle of Transformative Developments"
 

Facebook Login & Open Graph Introduction