This Flutter project demonstrates how to implement user authentication using Firebase. Firebase offers a powerful and secure way to manage user authentication in your Flutter apps. In this project, we'll walk you through the steps to set up Firebase Authentication, along with a basic Flutter app that allows users to sign up, sign in, and sign out.
Before you begin, make sure you have the following installed:
-
Clone the repository
git clone https://github.com/yourusername/flutter-firebase-authentication.git
-
Navigate to the project folder
cd flutter-firebase-authentication
-
Install dependencies
flutter pub get
-
Create a Firebase project
- Visit the Firebase Console.
- Click on "Add project" or select an existing project.
-
Set up your app in Firebase
- Add an app to your project by clicking on the Android or iOS icon (whichever is applicable).
- Follow the on-screen instructions to register your app with Firebase.
-
Add Firebase configuration files
- Download the
google-services.json
file (for Android) orGoogleService-Info.plist
file (for iOS) from the Firebase Console. - Place these files in the respective platform directories (
android/app
andios/Runner
).
- Download the
-
Configure Firebase Authentication
- In the Firebase Console, go to "Authentication" and enable the desired sign-in methods (e.g., Email/Password, Google, etc.).
-
Update Firebase configuration in your Flutter app
- Open the
lib/config/firebase_config.dart
file. - Replace the
apiKey
,authDomain
,projectId
,storageBucket
, andmessagingSenderId
with your Firebase project configuration.
- Open the
-
Run the app
flutter run
-
Sign up and Sign in
- Open the app and create a new account or sign in using your email and password.
-
Sign out
- You can sign out by clicking the "Sign Out" button.
/lib
contains the Flutter code for the authentication app./lib/config
holds the Firebase configuration.
This project is open-source and available under the MIT License.
Feel free to adapt and expand this README to suit your specific project's needs. Ensure you update the paths, filenames, and other details to match your actual project structure.