October 15th, 2011 |
Facebook
| 3 Comments »
Overview of the Like button Plugin
Like button is everywhere. From small to large web sites, it gives the Facebook user the ability to publish a content from a web site to a user’s wall as well as in a user’s friends’ newsfeed by just clicking a button. The content that was published has a link back to the web site.
According to Facebook, the reason why they deprecated the old share button is that…
“The Like button improves clickthrough rates by allowing users to connect with one click, and by allowing them to see which of their friends have already connected”
Implementation of Like Button is available in HTML5, XFBML and Iframe. HTML5 and XFBML requires the Javascript SDK.
An example of Facebook Like button
Read more…
September 21st, 2010 |
Facebook
| 2 Comments »
In Facebook’s Single Sign-on using JavaScript SDK , i discussed how single-sign on works. Now, I will discuss how to use the signed cookie and curl in fetching the active user’s data.
Parsing the signed cookie
Below is a script that is available in the facebook developer’s page. It parses the signed cookie saved on your registered site having the fbs_APP_ID format.
function get_facebook_cookie($app_id, $application_secret) {
$args = array();
parse_str( trim( $_COOKIE['fbs_' . $app_id], '\\"' ), $args );
ksort( $args );
$payload = '';
foreach ( $args as $key => $value ) {
if ($key != 'sig') {
$payload .= $key . '=' . $value;
}
}
if ( md5( $payload . $application_secret ) != $args['sig'] ) {
return null;
}
return $args;
}
The most important part of the cookie that we will use is the access_token. If the token is incorrect the Graph API will give a OAuthException error type.
Read more…
September 18th, 2010 |
Facebook
Using JavaScript SDK is an easy way to implement login and sign up using OAuth 2.0 protocol.
How does it work?
The JavaScript SDK saves the credentials for the active facebook user in a cookie on your registered site’s domain. Once there is a cookie present, you can fetch the active facebook user’s information in facebook and use it in your code.
Session Detection
The SDK automatically detects if there is a cookie present in your registered site. If there is, it will automatically login the currrent user without the need to click the facebook login button.
Read more…