Saturday, February 2, 2013

Facebook Login

Facebook Login for iOS allows you to obtain an access token to access Facebook services on behalf of a user. You can use this feature in place of building your own account system or to add Facebook services to your existing accounts.

Today there are three ways a user can login to Facebook. Originally using Facebook Login in your iOS app would show an in-app web view where the user could connect. In late 2010 we introduced a faster technique called Facebook Login that enabled one-click access for user using the native Facebook for iOS app. In iOS 6, Apple is introducing Facebook integration built into iOS directly, which further simplifies the process.

The Facebook SDK for iOS will automatically choose the best option when you attempt to use Facebook login. If a user previously gave your app permissions, the SDK will immediately return an OAuth 2 access token back to your app, possibly without even showing the user a prompt. For this reason, we recommend you always use the Facebook SDK for iOS to obtain Facebook access tokens.

This article walks through the following topics:

*Login Setup
  • Step 1: Get Started
  • Step 2: Set Up your Xcode Project
  • Step 3: Include the Facebook SDK
  • Step 4: Implement the Login Flow
  • Step 5: Implement the Logout Flow
*Best Practices
  • Pro-tip 1: Include Facebook Login at User Registration
  • Pro-tip 2: Request Only the Permissions Your App Needs
  • Pro-tip 3: Complete All iOS App Settings