CodeSamplez.com

Programming, Web development, Cloud Technologies

  • Facebook
  • Google+
  • RSS
  • Twitter
  • 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
Home Development Important Factors On Facebook API Authentication

Important Factors On Facebook API Authentication

Rana Ahsan January 13, 2011 4 Comments


 Important Factors On Facebook API Authentication    

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 🙂

Related

Filed Under: Development Tagged With: facebook

About Rana Ahsan

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

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.

Email Subscription

Never miss any programming tutorial again.

Popular Tutorials

  • How To Work With JSON In Node.js / JavaScript
  • PHP HTML5 Video Streaming Tutorial
  • Generate HTTP Requests using c#
  • How To Work With C# Serial Port Communication
  • Facebook C# API Tutorials
  • LinQ Query With Like Operator
  • LinQ To SQL Database Update Operations In C#
  • Get Facebook C# Api Access Token
  • Utilizing Config File In C#.NET Application
  • Control HTML5 Audio With Jquery

Recent Tutorials

  • Building Auth With JWT – Part 1
  • Document Your REST API Like A Pro
  • Understanding Golang Error Handling
  • Web Application Case Studies You Must Read
  • Getting Started With Golang Unit Testing
  • Getting Started With Big Data Analytics Pipeline
  • NodeJS Tips And Tricks For Beginners
  • Apple Push Notification Backend In NodeJS
  • Web Based Universal Language Translator, Voice/Text Messaging App
  • How To Dockerize A Multi-Container App From Scratch

Recent Comments

  • intolap on PHP HTML5 Video Streaming Tutorial
  • manishpanchal on PHP HTML5 Video Streaming Tutorial
  • Rana Ghosh on PHP HTML5 Video Streaming Tutorial
  • ld13 on Pipe Email To PHP And Parse Content
  • Daniel on PHP HTML5 Video Streaming Tutorial

Archives

Resources

  • CodeSamplez.com Demo

Tags

.net apache api audio aws c# cache cloud server codeigniter deployment doctrine facebook git github golang htaccess html5 http image java javascript linq mysql nodejs oop performance php phpmyadmin plugin process python regular expression scalability server smarty ssh tfs thread tips ubuntu unit-test utility web application wordpress wpf

Copyright © 2010 - 2021 · CodeSamplez.com ·

Copyright © 2021 · Streamline Pro Theme on Genesis Framework · WordPress · Log in