facebook login & open graph introduction
Post on 22-Jul-2015
213 Views
Preview:
TRANSCRIPT
Contents
Facebook API
Oauth
Facebook Login (Website)
Facebook Login (Server)
Exchange Access Token
Open Graph
Facebook Login (Website)
Users can log in your website by Facebook
You can get user data over Facebook API
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.
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 AccessTokenRequest 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 AccessTokenResponse 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-LivedAccessToken
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}
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/how-to--handle-expired-access-tokens/
top related