Feature SDKs (Pro)
social_auth_sdk Pro
- Tier
- Proversion 2.0.5
- Command
archipelago generate social_auth_sdk- Generates
features/social_auth/social_auth_apifeatures/social_auth/social_auth_implfeatures/social_auth/apple_social_auth_impl(if selected)features/social_auth/facebook_social_auth_impl(if selected)features/social_auth/google_social_auth_impl(if selected)
- Generates first
- monitoring_sdk, auth_sdkwhen needed and missing, so there is nothing to install first
Social authentication feature SDK with per-provider packages (Google, Apple, Facebook), mirroring
analytics_sdk's multi-impl pattern. Integrates withauth_sdkfor seamless login flow.
Variables
| Variable | Type | Default | Description |
|---|---|---|---|
includeGoogle | boolean | true | Generate google_social_auth_impl (Google Sign-In) |
includeApple | boolean | true | Generate apple_social_auth_impl (required by App Store whenever any other provider is enabled) |
includeFacebook | boolean | false | Generate facebook_social_auth_impl (Facebook Login) |
Install
Interactive
archipelago generate social_auth_sdkNon-interactive (CI)
archipelago generate social_auth_sdk --config my_config.jsonpre_gen aborts generation (exit code 1) if all three provider flags are false — at least one provider must be enabled. If includeApple is false while another provider is true, it prints a warning (not an abort): Apple App Store guideline 4.8 requires Sign in with Apple whenever another third-party social login is offered.
Prerequisites
social_auth_impl path-depends directly on the auth_api and monitoring_api packages, and the SocialAuthSDK factory reads AuthSDK and AppMonitoring when the SDK is first resolved. pre_gen self-generates monitoring_sdk first and then auth_sdk via SubBrickGenerator if either is missing, so no manual step is needed.
Generated Packages
| Package | Condition | Description |
|---|---|---|
social_auth_api | Always | Contract + shared models (no plugin deps) |
social_auth_impl | Always | Orchestrator — discovers provider handlers via getIt.getAll(), integrates with AuthSDK/AppMonitoring |
google_social_auth_impl | includeGoogle | Google Sign-In handler (google_sign_in) |
apple_social_auth_impl | includeApple | Sign in with Apple handler (sign_in_with_apple) |
facebook_social_auth_impl | includeFacebook | Facebook Login handler (flutter_facebook_auth) |
Generated Structure
features/
└── social_auth/
├── social_auth_api/
│ └── lib/src/
│ ├── social_auth_sdk.dart
│ ├── social_auth_provider_handler.dart
│ └── models/ # SocialAuthProvider, SocialAuthResult, SocialAuthCredential, SocialAuthFailureReason
├── social_auth_impl/
│ └── lib/src/
│ ├── social_auth_sdk_impl.dart
│ └── di/
├── google_social_auth_impl/ # if includeGoogle
├── apple_social_auth_impl/ # if includeApple
└── facebook_social_auth_impl/ # if includeFacebookMason renders all three provider directories unconditionally (mustache path gating leaves empty dirs); post_gen.dart's _cleanupDisabledProviders deletes the ones whose flag is false.
Public API
final socialAuth = getIt<SocialAuthSDK>();
if (socialAuth.isProviderAvailable(SocialAuthProvider.google)) {
final result = await socialAuth.signIn(SocialAuthProvider.google);
switch (result) {
case SocialAuthSuccess():
// orchestrator already called AuthSDK.loginSuccess(userId: ...) for you
break;
case SocialAuthCancelled():
break; // user tapped back — silent, no monitoring
case SocialAuthFailure(:final reason):
break; // reason: notSupported | providerError
}
}
await socialAuth.signOut(); // fans out to every registered provider, idempotentavailableProviders only reflects providers whose package was actually generated and wired into DI — use it to conditionally show login buttons. Calling signIn() for a provider with no registered handler returns SocialAuthFailure(reason: notSupported) without throwing or logging; any exception a handler throws is caught, reported to AppMonitoring, and returned as SocialAuthFailure(reason: providerError).
DI & Wiring
The post-gen hook wires everything into the app's injector.dart and pubspec.yaml automatically — no manual DI edits required:
- Each enabled provider's
*PackageModuleis registered first (as an external module). Each handler registers as@Named('<provider>')(google,facebook,apple), so several providers can coexist. SocialAuthImplGlobalModule(the orchestrator) is registered last; its lazy factory resolves every registered handler throughgetIt.getAll<SocialAuthProviderHandler>().- Disabled providers are stripped from both the injector and the app's
pubspec.yamlon re-runs with changed flags.
SocialAuthImplGlobalModule registers SocialAuthSDK as a lazy singleton (since 2.0.0). Nothing runs at boot: each handler initialises its vendor SDK on its first sign-in, and the handler list is read when the SDK is first resolved.
Dependencies
google_social_auth_impl:google_sign_in ^7.2.0apple_social_auth_impl:sign_in_with_apple ^8.1.0,crypto ^3.0.7facebook_social_auth_impl:flutter_facebook_auth ^7.2.0social_auth_api/social_auth_impl: no vendor SDKs —equatable,feature_sdk,monitoring_api,auth_apionly
Platform Setup
None of this is automated by hooks — each provider needs manual dashboard/native config:
Google Sign-In
- Add your OAuth 2.0 client ID to
android/app/build.gradle(resValue) and iOSInfo.plist(CFBundleURLSchemes). - See: https://pub.dev/packages/google_sign_in
Sign in with Apple
- Enable the Sign in with Apple capability in Xcode.
- Configure an Apple Services ID for web/Android redirect.
- See: https://pub.dev/packages/sign_in_with_apple
Facebook Login
- Add your App ID and Client Token to
android/app/res/values/strings.xmland iOSInfo.plist. - See: https://pub.dev/packages/flutter_facebook_auth
Limitations
- No platform files (manifests, plist, gradle) are written automatically for any provider — all three require manual dashboard setup per-provider.
- Apple App Store guideline 4.8 compliance is only a generation-time warning, never enforced — you can still generate and ship Google/Facebook without Apple.
Changelog
Run archipelago brick info social_auth_sdk to see the latest published version. Enterprise customers can read the full CHANGELOG.md in the brick source repository.