Facebook Login for Android
Facebook Login allows you to obtain a token to access Facebook's API on behalf of someone using your app. You can use this feature in place of building your own account system or to add Facebook services to your existing accounts.
The Facebook SDK for Android provides methods to implement Facebook Login for your app. The SDK provides Facebook Login support for the these common scenarios:
Your app uses only Facebook Login to authorize people using your app.
Your app provides two login options: Facebook Login and your own login mechanism.
Your app uses your own login initially and Facebook Login is an option to switch on certain social features.
In cases (1) and (3), the Facebook SDK provides a UserSettingsFragment class that can be hosted by your login activity to display the Facebook login/logout button. In case (2), the Facebook SDK provides a LoginButton class that provides a button you can drop into your UI. The LoginButton class maintains the session state and is used to log people in and out.
In this document, we'll build on case (2) and show you how to implement Facebook Login with LoginButton. Many of the points also apply if you use the UserSettingsFragment class.
This document walks through the following topics:
Prerequisites
App Dashboard configuration
Sample overview
Step 1: Implement the authentication flow
Step 2: Set up authentication change triggers
Step 3: Ask for permissions
Troubleshooting
Best practices
Pro tip 1: Include Facebook Login when someone registers to use your app
Pro tip 2: Request only the permissions you need
Permissions
Login dialogs
Additional information