keycloak_wrapper
1.5.1, released 2 months ago by fafifi.is-a.dev
Keycloak Single Sign-On authentication package for Flutter.
What it does
Integrates Keycloak Single Sign-On (SSO) authentication into Flutter apps using OAuth 2.0 and OpenID Connect. Manages tokens automatically under the hood and provides a user authentication state stream.
AI-written summary of version 1.5.1, based on the package's README and metadata. Report an inaccuracy
Use it when
- You need to authenticate users via Keycloak in your Flutter application.
- You want automatic token management and secure token storage using Keychain or Keystore.
Skip it when
- You are using Firebase or Supabase authentication instead of Keycloak.
- You need automated tests for the authentication flow, which are unsupported due to the webview login requirement.
Strengths
- Provides an authentication state stream to keep the app in sync with login status changes.
- Automatically manages and securely stores tokens under the hood.
- Supports custom iOS/macOS web authentication session settings.
Weaknesses
- All test files were removed because users must log in via the webview, making it untestable.
- Requires native configuration adjustments on Android, iOS, and macOS.
Setup
- Kind
- Flutter widgets
- Effort
- Medium
- Code generation
- No
- Direct dependencies
- 3
Requires adding a valid redirect URI in the Keycloak console, setting up custom schemes in Android build.gradle (manifestPlaceholders) and iOS/macOS Info.plist, and removing android:taskAffinity='' from AndroidManifest.xml if using Flutter v3.22.0 or newer.
final keycloakWrapper = KeycloakWrapper();
void main() {
WidgetsFlutterBinding.ensureInitialized();
keycloakWrapper.initialize(
config: KeycloakConfig(
bundleIdentifier: '<bundle_identifier>',
clientId: '<client_id>',
frontendUrl: '<frontend_url>',
realm: '<realm>',
),
);
runApp(const MyApp());
}Alternatives
Packages that do the same job and could replace keycloak_wrapper.
- openidconnect
Standards-compliant OpenID Connect client library for Flutter with multi-flow authentication support.
76Compare - google_sign_in_ios
iOS and macOS implementation of Google Sign-In for Flutter
90Compare - google_sign_in_android
Android implementation of the google_sign_in plugin
88Compare - firebase_auth
Flutter plugin for Firebase Authentication enabling passwords, phone numbers, and identity providers.
99Compare
Works with
Packages commonly used together with keycloak_wrapper: ones it builds on, ones built on it, and its own family.
- shared_preferenceskeycloak_wrapper depends on itFlutter plugin for reading and writing simple key-value pairs. Wraps NSUserDefaults on iOS and SharedPreferences on Android.
- flutter_secure_storagekeycloak_wrapper depends on itSecure key-value storage using platform-specific secure mechanisms
- flutter_appauthkeycloak_wrapper depends on itFlutter plugin for OAuth 2.0 and OpenID Connect authentication using native AppAuth SDKs.