Facebook Authentication and Why It's Important
WEBINAR: On-demand webcast
How to Boost Database Development Productivity on Linux, Docker, and Kubernetes with Microsoft SQL Server 2017 REGISTER >
In today's internet age, everything and everyone is interconnected, and mostly without actual wires. Websites are interconnected, people are linked to each other on social networking sites and are linked to pages and sites on internet by means of either being owners of the pages or having liked it.
Until a few years ago, web developers only had to deal with making their website search engine friendly, which meant follow certain guidelines set by Google, which is arguably the number one search engine on the internet.
Today that is not enough because Google is not the only place people discover new websites. Social networks like Facebook and the new Google Plus are an emerging source for driving internet traffic to your website.
Social networks suggest links to you that either your friends have recommended for you or that they have liked. This increases the chances of the user also liking the site and they tend to spend more time on the site when compared to a user who was directed via a search engine.
Facebook is to social networks as Google is to search engines; so let us see how you can use Facebook to increase traffic to your website. Considering that you've spent a substantial amount of time socializing on Facebook, you may have noticed that when you begin using an application, you are first presented with a screen where you have to grant the application permission to access your personal information.
There adds a certain amount of confusion in people's minds whether they need the same when they are integrating Facebook with their site. The answer to that question is Yes and No because it depends what level of integration you require.
Is there a need to Authenticate with Facebook even?
This is the fundamental question that needs to be answered. A lot of developers skip this question and simply throw in the authentication code when they are building the website so that they don't have to deal with issues in the future. Doing this however has certain downsides. Every time the page loads, a call is made to Facebook to check if the user is authenticated etc. This slows down the site and might not really bring any benefits.
In many cases, it is possible to provide Facebook's social functionality on your website with ease, without any authenticating process. Facebook provides simple iframe based tags to perform common tasks, such as 'Like', 'Share', 'Live Streams' and 'Comment'. The code detects the user's session and if no user is logged in, it will popup a box asking the user to do so. So if this is all you need, then you don't have to bother implementing the authentication at all.
When Authenticating, Ask for Proper Permission
If you want access to any information of the user, you need to get the user's permission. You should remember that your application getting permission doesn't mean that you can access whatever information about the user that you want. The default permission only shares certain information with your application; however, with the extended permissions you can obtain the permission to access more information about your user as well as publish on their Facebook streams.
Bear one thing in mind that you should only ask for permission to do what you want to do. For example, asking for permission to get access to the user's email address might drive many potential users away; so be sure that if you are asking for their email address, you really want to sent out emails to them.
In this article we discussed how Facebook handles authentication and the points that you need to bear in mind while deciding whether you require to authenticate your users with Facebook, and you do, then what are the permissions you require. In the coming years, we might see other social networks gain in popularity and then the choice for us will be to see whether we want to support multiple networking sites or just stick with one and keep the code a lot more manageable.
That said, it will take a long time for someone to take over the place Facebook has in people's minds and tongues. The moment you speak of the web, more often than not, the conversation doesn't end without the mention of Facebook.