Category Archives: Facebook API

Gradle – Run Facebook SDK on Android Studio

1. Download and install the Android Studio.

2. Create a new project.
gradle-facebook-sdk-on-android-stuido-1
Continue reading Gradle – Run Facebook SDK on Android Studio

Advertisements

Drupal 7 – Get Facebook Page feeds by Aggregator

You can get the Facebook Page content by the following URLs:

RSS 2.0
http://www.facebook.com/feeds/page.php?format=rss20&id=[fb-page-id]
Atom 1.0
http://www.facebook.com/feeds/page.php?format=atom10&id=[fb-page-id]

 

Where the [fb-page-id] could be found by browsing your Facebook Page -> Edit Page. That URL should have the following format.

https://www.facebook.com/pages/edit/?id=%5Bfb-page-id%5D&sk=basic

Continue reading Drupal 7 – Get Facebook Page feeds by Aggregator

Facebook Javascript SDK – Logout with OAuth 2.0

Now we have OAuth 2.0 working with the Facebook Javascript SDK as mentioned in the last article.
Facebook Javascript SDK – A Simple Login Page with OAuth 2.0

The above example is incomplete as there is no logout link. Replace the fb-login-oauth2.php as follow. Continue reading Facebook Javascript SDK – Logout with OAuth 2.0

Facebook Javascript SDK – A Simple Login Page with OAuth 2.0

A few months ago, i published several posts about Facebook Javascript SDK but they no longer work since Facebook updates to OAuth 2.0. So this post is the updated version of
Facebook Javascript SDK – A Simple Login Page
and it should work works with OAuth2. Continue reading Facebook Javascript SDK – A Simple Login Page with OAuth 2.0

Facebook Javascript SDK – Redirect to request for permissions page if the user is not logged in or not subscribed

We can find out the Request for permissions URL of a Facebook application as we discussed previously.
Facebook API – Request for permissions URL

So you can force the user to grant the permissions for your Facebook application by checking their login status and redirecting to the above URL if they are unknown user. Continue reading Facebook Javascript SDK – Redirect to request for permissions page if the user is not logged in or not subscribed

Facebook API – Request for permissions URL

The following URL is the request for permissions page of a Facebook application.

The [FB_APP_URL] is the App Namespace which is set in the Facebook application settings.

The [PERMISSIONS] is the comma separated string. (ex. email,read_stream)

Done =)

Reference: Authentication – Facebook Developers

Facebook Javascript SDK – Logout

 
Update 2012-01-14: For OAuth 2.0 implementation, please refer to the new post.
Facebook Javascript SDK – Logout with OAuth 2.0

Update 2011-12-19: Since Facebook has updated their authentication system and HTTP to OAuth 2.0 and HTTPS. The following example will not work any more. i will update the post later. For more information, you can refer to Jerry Cain – Updated JavaScript SDK and OAuth 2.0 Roadmap

 

Add the following Javascript function for Facebook logout.

function logoutFacebook() {
  FB.init({ 
    appId:'<?php print YOUR_APP_ID; ?>', cookie:true, 
    status:true, xfbml:true
  });
  FB.logout(function() {
    // Reload the same page after logout
    window.location.reload();
    // Or uncomment the following line to redirect
    //window.location = "https://ykyuen.wordpress.com";
  });
}

Continue reading Facebook Javascript SDK – Logout