• Skip to main content
  • Skip to primary sidebar
  • Skip to footer
  • Home
  • Featured
    • C# Tutorials
      • LinQ Tutorials
      • Facebook C# API Tutorials
    • PHP Tutorials
      • CodeIgniter Tutorials
    • Amazon AWS Tutorials
  • Categories
    • Programming
    • Development
    • Database
    • Web Server
    • Source Control
    • Management
    • Project
  • About
  • Write
  • Contact

CodeSamplez.com

Programming, Web development, Cloud Technologies

You are here: Home / Development / Important Factors On Facebook API Authentication

Important Factors On Facebook API Authentication

January 13, 2011 by Rana Ahsan 4 Comments

Facebook API Tutorials

As a general facebook user, when we go to use an facebook application, we get an window titled ‘Request For Permission’ . After clicking ‘Allow’ button, we can enter the application. This is an very usual scenario. Its a very important stage for developing an facebook application, where couple of things must be noticed very carefully for creating the process in the most suitable way. Here, I will give some important tips which you should follow while creating an facebook based application and implementing facebook authentication.

Facebook Authentication Example

Need facebook api authentication at all?

In many cases its possible to integrate facebook’s provided functionality for social optimization of your site very easily, without any need of authentication process. This are provided by facebook as simple html code snippet, which are iframe based. Those code on iframe automatically detect a member’s session and provide options to contribute to the site by his activities. These are very well known activities , such as ‘Like’,’Share’,’Comment’,’Live streams’ etc. So, if your need are something around these, you shouldn’t be worry about implementing authentication at all.

Ask for proper extended permissions:

Now, we need user authentication actually so that we can access some of user’s private information and also write data to users facebook streams. You should remember that, your application is getting permission that doesn’t mean that you can access whatever you want. There are a lot of facebook api methods, which requires special extended permission before they can be accessed. So, first measure your application purpose first, what kind of permissions you may need and then add them while implement the authentication process.

For how long you want user to authenticate:

You must have to remember that, in general traditional authentication, session time to access private data from your is limited and it gets expired after a certain time. If you want user to access your application in future without authenticate again, you will have to get an ‘offline_access’ extended permission, which doesn’t have any expiry time, so you can save that against a user and use as many times as you need. Best and easiest way to do this, is to save the access token in cookie with a long expiation duration and retrieve that whenever user tries to access the application.

Do your application requires offline access permissions?

You also need to determine whether you will need access to user profile for retrieve private data, publish data to user’s time line etc when user isn’t online/not using the application. If you need so, you will require to get ‘offline_access’ extended permission as like the previous point.However, it won’t be enough to save the save the access token in cookie this time as you will need accessing this beyond user interactions. Best way to get this done is to save the access token to database along with user id so that you can retrieve that later when needed.

References:

FOr official documentation, you can facebook authentication overview. If you are trying ti find out pratical way/code samples to implement facebook api authentication(specially retrieve the access token as this the main part) and you are a C# developer, then refer to my another article on getting facebook api access token in c#. Hope this will help you. If you need anything else, let me know. Happy coding 🙂

Share If Liked

  • Click to share on Facebook (Opens in new window)
  • Click to share on Twitter (Opens in new window)
  • Click to share on LinkedIn (Opens in new window)
  • Click to share on Pinterest (Opens in new window)
  • Click to share on Reddit (Opens in new window)
  • Click to share on Tumblr (Opens in new window)
  • Click to share on Pocket (Opens in new window)

You may also like

Filed Under: Development Tagged With: facebook

About Rana Ahsan

Rana is a passionate software engineer/Technology Enthusiast.
Github: ranacseruet

Reader Interactions

Comments

  1. Thary says

    July 21, 2011 at 9:26 am

    Your website is very interesting and detail but I want to ask you some related to FB authentication. After I authenticate my app and then I can access to FB data which means what I need but after that I want to access to FB data again in the next page, after loading new page but I can’t access or get any data from
    FB it seems like I haven’t authenticated the app. (I use php and php sdk)

    Reply
  2. JCO9 says

    November 3, 2016 at 10:54 am

    Rana, it si very helpful all the code and examples you show here thank you very much for that.
    I want to thank you rather than asking for things but pelase allow me to ask you this, I am trying to make a system (Asp.NET c# website) that searches for posts in Facebook that contains some key words and to retrieve the number of likes/comments/shares and texto fo the post, I have spent several hours to try to figure out how to accoplish this and I find nothing clear, do you know any guide or good starting point to do so?

    Many thanks again.

    Reply

Trackbacks

  1. Javascript Tutorials And Examples On Facebook Graph Api | codesamplez.com says:
    February 9, 2011 at 12:15 am

    […] to user's facebook timeline(user must have allowed 'publis_stream' access for this purpose. See facebook authentication guide for more about authentication […]

    Reply
  2. Facebook Graph Api C# Tutorial | codesamplez.com says:
    December 20, 2012 at 4:31 am

    […] special extended permissions. If don't have details idea, consider reading my another article for facebook authentication guide. After completing the authentication part, we are ready to query the fb api for accessing private […]

    Reply

Leave a Reply Cancel reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Primary Sidebar

Subscribe to Blog via Email

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

Join 3,774 other subscribers

Follow Us

  • Twitter
  • Facebook

Top Posts & Pages

  • How To Work With JSON In Node.js / JavaScript
    How To Work With JSON In Node.js / JavaScript
  • PHP HTML5 Video Streaming Tutorial
    PHP HTML5 Video Streaming Tutorial
  • How To Work With C# Serial Port Communication
    How To Work With C# Serial Port Communication
  • Facebook C# API Tutorials
    Facebook C# API Tutorials
  • Using Supervisord Web Interface And Plugin
    Using Supervisord Web Interface And Plugin
  • Utilizing Config File In C#.NET Application
    Utilizing Config File In C#.NET Application
  • LinQ Query With Like Operator
    LinQ Query With Like Operator
  • Getting Started With UDP Programming in Java
    Getting Started With UDP Programming in Java
  • Generate HTTP Requests using c#
    Generate HTTP Requests using c#
  • How To Use Hotkeys/Keyboard Events In WPF Application Using C#
    How To Use Hotkeys/Keyboard Events In WPF Application Using C#

Recent Posts

  • Building Auth With JWT – Part 2
  • Building Auth With JWT – Part 1
  • Document Your REST API Like A Pro
  • Understanding Golang Error Handling
  • Web Application Case Studies You Must Read

Tags

.net angularjs apache api audio auth authenticatin aws c# cloud server codeigniter deployment docker doctrine facebook git github golang htaccess html5 http javascript jwt linq mysql nodejs oop performance php phpmyadmin plugin process python regular expression scalability server smarty socket.io tfs tips unit-test utility web application wordpress wpf

Footer

Archives

Follow Us

  • Twitter
  • Facebook

Subscribe to Blog via Email

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

Join 3,774 other subscribers

Copyright © 2023