Skip to main content

Overview

This guide will walk you through implementing Facebook Login in your React Native app. You’ll learn how to:
  • Initialize the Facebook SDK
  • Add a Facebook Login button
  • Handle login callbacks
  • Access user information
Make sure you’ve completed the Installation guide before proceeding.

Step 1: Initialize the SDK

Before using any Facebook SDK features, you need to initialize it. Add this code to your app’s entry point (usually App.js or App.tsx):
Starting with iOS SDK v9.0.0, Facebook removed automatic initialization to comply with Apple’s privacy requirements. You must explicitly initialize the SDK before using any Facebook features.For GDPR compliance, you may want to delay initialization until after obtaining user consent.

Step 2: Add Facebook Login Button

The LoginButton component provides a ready-to-use Facebook-branded login button:
App.js
The LoginButton automatically shows “Log in with Facebook” when logged out and “Log out” when logged in.

Step 3: Request Specific Permissions

By default, the login button requests public_profile permission. To request additional permissions:
Some permissions require Facebook App Review approval before they can be used in production. Learn more at Facebook Login Permissions.

Step 4: Get Access Token

After a successful login, retrieve the access token to make Graph API requests:

Step 5: Fetch User Profile

Use the Graph API to retrieve user information:
The email field requires the email permission to be granted by the user.

Step 6: Use Login Manager (Programmatic Login)

For custom UI, use the LoginManager instead of the LoginButton:

iOS: Limited Login

For iOS apps using React Native FBSDK Next >= 13.0.0, you may need to use Limited Login if users have opted out of App Tracking Transparency (ATT).
With Limited Login, you receive an AuthenticationToken instead of an AccessToken:
An AuthenticationToken (from Limited Login) cannot be used to access the Facebook Graph API. It’s an OpenID Connect token used for authentication only.

Complete Working Example

Here’s a full example combining all the concepts:

Testing Your Integration

1

Test in Development

Run your app on a real device or simulator:
2

Verify Login Flow

  • Tap the Facebook Login button
  • Complete the authentication flow
  • Verify that user data is displayed correctly
  • Test logout functionality
3

Check Facebook App Dashboard

Monitor login events in your Facebook App Dashboard under Analytics > Events.

Troubleshooting

  • Ensure you’ve called Settings.initializeSDK()
  • Verify your Facebook App ID is correctly configured
  • Check that native setup is complete (Info.plist on iOS, AndroidManifest.xml on Android)
This error occurs when:
  • Using an AuthenticationToken (from Limited Login) with Graph API
  • Access token has expired
  • Facebook App is in Development mode and the user is not a tester/admin
Solution: Use loginTrackingIOS="enabled" for standard login with Graph API access.
  • Ensure you’ve requested the email permission
  • User must approve the email permission
  • Some users may not have an email associated with their Facebook account
  • Verify you’ve added the openURL method in AppDelegate
  • Check that Facebook App ID is in Info.plist
  • Ensure CocoaPods dependencies are properly installed

Next Steps

Sharing Content

Learn how to share links, photos, and videos to Facebook

Graph API

Make advanced requests to Facebook’s Graph API

App Events

Track user actions and conversions for analytics

Advanced Login

Implement custom login flows and handle permissions