Skip to main content
The LoginManager class provides methods to perform Facebook Login operations programmatically, giving you full control over the login flow.

Import

Methods

logInWithPermissions

Logs in a user with the requested permissions.

Parameters

Returns

Promise<LoginResult> - Resolves with a LoginResult object containing:

Example

iOS Limited Login Example


logOut

Logs out the currently logged-in user.

Example


setLoginBehavior

Sets the login behavior for Android. iOS always uses browser-based login.

Parameters

LoginBehaviorAndroid values:
  • 'native_with_fallback' (default) - Attempt Facebook app login, fall back to web dialog
  • 'native_only' - Only use Facebook app for login
  • 'web_only' - Only use web dialog for login

Example


getLoginBehavior

Gets the current login behavior setting (Android only).

Returns

Promise<LoginBehavior> - Resolves with the current login behavior:
  • On Android: One of LoginBehaviorAndroid values
  • On iOS: Always returns 'browser'

Example


setDefaultAudience

Sets the default audience for posts made by the application.

Parameters

DefaultAudience values:
  • 'friends' - Only friends can see posts
  • 'everyone' - All Facebook users can see posts
  • 'only_me' - Only the user can see posts

Example


getDefaultAudience

Gets the current default audience setting.

Returns

Promise<DefaultAudience> - Resolves with the current default audience setting.

Example


reauthorizeDataAccess

Re-authorizes the user’s data access. Use this when data access permissions have expired.

Returns

Promise<LoginResult> - Same as logInWithPermissions.

Example

Types

DefaultAudience

Indicates which default audience to use for sessions that post data to Facebook.

LoginBehavior

Union type for all login behaviors across platforms.

LoginBehaviorAndroid

Indicates how Facebook Login should be attempted on Android.
  • native_with_fallback - Try Facebook app, fall back to web dialog
  • native_only - Only use Facebook app
  • web_only - Only use web dialog

LoginBehaviorIOS

iOS only supports browser-based login through Safari or in-app browser.

LoginResult

Represents the result of a login operation.

LoginTracking

iOS only. Determines the login tracking mode:
  • 'enabled' - Traditional login with full tracking (default)
  • 'limited' - Limited Login for privacy-focused authentication

Complete Usage Example

See Also

Login Methods

Learn about different login methods

Authentication

Understand access tokens and authentication

AccessToken

API reference for AccessToken

LoginButton

API reference for LoginButton component