A Flutter project demonstrating Firebase Authentication with email/password and Google Sign-In.
- User authentication with email/password
- Google Sign-In integration
- Password reset functionality
- Role-based authorization (admin access)
- Secure token storage
- Form validation
- User-friendly error handling
- Clean architecture with Provider pattern
- Create a Firebase project at Firebase Console
- Register your app (Android and/or iOS)
- Download the configuration files:
- For Android:
google-services.json(place inandroid/app/) - For iOS:
GoogleService-Info.plist(place inios/Runner/)
- For Android:
The Firebase configuration files contain API keys and should not be committed to version control. This repository includes template files:
android/app/google-services.json.templateios/Runner/GoogleService-Info.plist.template
Copy these template files, rename them to remove the .template extension, and add your actual Firebase credentials.
- Configure OAuth consent screen in Google Cloud Console
- Enable Google Sign-In in Firebase Authentication settings
- Add SHA-1 certificate fingerprint to your Firebase project for Android
-
Install dependencies:
flutter pub get
-
Add Google logo image:
- Place a Google logo image in
assets/google_logo.png
- Place a Google logo image in
-
Run the app:
flutter run
AuthService: Handles Firebase authentication operationsAuthProvider: State management using Provider pattern- UI Components:
LoginScreen: Email/password login and registrationHomeScreen: Authenticated user dashboardAdminPanel: Role-restricted area
Run tests with:
flutter test- Firebase Authentication Documentation
- Google Sign-In for Flutter
- Flutter Provider Package
- Flutter Secure Storage
- Keep your
google-services.jsonandGoogleService-Info.plistfiles out of version control (they're listed in .gitignore) - For CI/CD or team development, consider:
- Using environment variables to inject keys during build time
- Setting up secure credential storage in your CI system
- Using Firebase App Distribution for testing
This app uses flutter_secure_storage for storing sensitive user data like tokens. Never store sensitive information using regular SharedPreferences or other non-encrypted storage methods.