-
Notifications
You must be signed in to change notification settings - Fork 31
Description
Description:
Add Firebase Authentication to the Flutter app, enabling users to sign up and log in using Google or email/password. This will serve as the primary authentication system for OptiFit.
Tasks:
-
Set up Firebase Authentication in the Firebase console for the project.
-
Add
firebase_core,firebase_auth, andgoogle_sign_inpackages to the Flutter project. -
Initialize Firebase in the app (
main.dart). -
Implement email/password registration and login:
- Create UI for sign-up and login screens.
- Add validation for email format, password strength, and confirm password field.
- Display helpful error messages (invalid email, weak password, wrong credentials, etc.).
-
Implement Google Sign-In:
- Add “Continue with Google” button on login screen.
- Configure OAuth consent screen and SHA-1/SHA-256 fingerprints in Firebase console.
- Retrieve and store user profile data (name, email, photo URL).
-
Store basic user info (UID, email, display name, auth provider) in Firestore for later use.
-
Add loading indicators for all network calls.
-
Implement sign-out and handle proper state cleanup.
-
Redirect authenticated users to the main app screen; unauthenticated users to the login screen.
-
Ensure persistence across app restarts using Firebase’s built-in session management.
-
Update README with Firebase setup instructions for developers.
Acceptance Criteria:
-
Users can log in or register via Google or email/password.
-
Invalid credentials and network issues show proper error messages.
-
Auth state persists after restarting the app.
-
Logging out returns the user to the login screen and clears session data.
-
Firebase integration is stable and verified on both Android and iOS.
-
Screenshots included showing:
- Login and sign-up screens
- Successful login via Google
- User data visible in Firebase console