oauth_connection 1.1.0 copy "oauth_connection: ^1.1.0" to clipboard
oauth_connection: ^1.1.0 copied to clipboard

A comprehensive OAuth connection package for Google, Facebook, and Instagram authentication in Flutter.

oauth_connection #

A Flutter package for simplified, BLoC-powered OAuth authentication. This package provides a unified way to integrate Google, Facebook, Instagram, and Apple Sign-In with a clean, controller-based initialization and ready-to-use UI components.

Features #

  • Controller-Based Initialization: Configuration is decoupled from the UI, allowing you to initialize providers dynamically via dedicated controllers.
  • Native Apple Sign-In: Fully integrated for iOS and Android, supporting the latest App Store requirements.
  • Plug-and-Play Buttons: Pre-built, brand-compliant buttons that handle the entire OAuth flow internally.
  • Unified Listeners: Consistent success and failure callbacks across all social providers.
  • State Management: Built-in BLoC integration to handle authentication states seamlessly.

Getting started #

Add the dependency to your pubspec.yaml:

dependencies:
  oauth_connection: ^1.1.0

Platform Requirements #

  • iOS: Requires iOS 13.0 or higher. Ensure the "Sign In with Apple" capability is added in Xcode.
  • Android: Requires minSdkVersion 21 or higher.

The Core Idea #

The package operates on a simple Initialize -> Render -> Listen workflow.

1. Initialize via Controllers #

You don't need to pass configuration data directly to the UI. Instead, use the static init methods on the controllers (e.g., GoogleAuthController, AppleAuthController, etc.) to inject your backend endpoints, client IDs, and debugging preferences.

2. Drop in the Button #

Once a controller is initialized, simply export and use the corresponding button from the package. These buttons are self-contained and manage their own authentication logic.

3. Boom! Implement Listeners #

Every button provides standardized listeners. Just implement onSuccess to receive the access token and onFailure to handle errors with localized messages.

// Example of the "Plug and Play" buttons
AppleSignInButton(
  onSuccess: (state) => handleMySuccess(state.accessToken),
  onFailure: (state) => handleMyError(state.translatedMessage),
),

GoogleSignInButton(
  onSuccess: (state) => handleMySuccess(state.accessToken),
  onFailure: (state) => handleMyError(state.translatedMessage),
),


Localization #

The package includes built-in translations for the button labels. To support Apple Sign-In in Arabic, ensure your localization keys are mapped as follows:

"apple": {
  "signIn": "تسجيل الدخول باستخدام أبل",
  "signUp": "إنشاء حساب باستخدام أبل"
}

License #

MIT

0
likes
120
points
173
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

A comprehensive OAuth connection package for Google, Facebook, and Instagram authentication in Flutter.

Repository (GitHub)

License

BSD-3-Clause (license)

Dependencies

flutter, flutter_bloc, flutter_facebook_auth, flutter_localizations, font_awesome_flutter, google_sign_in, google_sign_in_ios, http, sign_in_button, sign_in_with_apple, webview_flutter

More

Packages that depend on oauth_connection