flutter_facebook_auth

repository·master·Indexed 42 days ago

https://github.com/darwin-morocho/flutter-facebook-auth

A Flutter plugin for Facebook authentication across iOS, Android, and Web. It enables developers to implement cross-platform login, manage permissions, retrieve user profiles, and obtain access tokens for Graph API requests. The package includes support for Android Express Login and provides separate implementations for macOS (flutter_facebook_auth_desktop) and Web (flutter_facebook_auth_web).

Tokens
7.7K
Snippets
28
Records
41
Agent score
52%

What's inside flutter_facebook_auth

  1. Overview of flutter_facebook_auth features

    master

    The flutter_facebook_auth plugin enables Facebook authentication within Flutter applications.

    Key Capabilities:

    • Platform Support: Login functionality for iOS, Android, Web, and macOS.
    • Android Specifics: Supports Express login on Android.
    • Permission Handling: Manages both granted and declined permission states.
    • User Data: Retrieves user information, profile pictures, and other metadata.
    • Graph API Integration: Provides an access token that can be used to make authenticated requests to the Facebook Graph API.
  2. Features of flutter_facebook_auth

    master

    The flutter_facebook_auth plugin provides the following capabilities:

    • Cross-platform Login: Supports iOS, Android, and Web.
    • Android Express Login: Provides an express login flow specifically for Android devices.
    • Permission Management: Handles both granted and declined permission states.
    • User Data Retrieval: Access to user information, profile pictures, and other metadata.
    • Graph API Integration: Provides an access token that can be used to make authenticated requests to the Facebook Graph API.
  3. Handle Limited Login and AccessToken types

    master

    To support Facebook's Limited Login mode (triggered on iOS when tracking is denied), the AccessToken class is now abstract. Depending on the login mode, you will receive one of two subtypes:

    • ClassicToken: Returned during standard login.
    • LimitedToken: Returned during Limited Login.

    Both subtypes implement the AccessToken interface, providing a type (of enum AccessTokenType) and a tokenString (the actual token string).

    Android Note: Starting from version 7.2.0, providing a nonce parameter in the login function forwards it to the native Android SDK. If successful, the returned ClassicToken will contain the authenticationToken (OIDC ID token). Note that the native Android SDK only returns this token on the first authorization.

  4. Install flutter_facebook_auth

    master

    Add flutter_facebook_auth to your pubspec.yaml dependencies.

    Important Requirements:

    • Dart Version: Since version 6.x, this plugin requires Dart 3.x or higher. Ensure your environment configuration in pubspec.yaml reflects this.
    • Android Configuration: You must complete the Android-specific configuration before running the project. Failure to do so will result in a No implementation found error, which can also lock other plugins in your project. If you are not ready to configure Android yet, comment out the plugin in your pubspec.yaml to avoid this error.
    dependencies:
      flutter_facebook_auth: ^7.2.0
    
    environment:
      sdk: ">=3.4.0 <4.0.0"