Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs(firebase_login): add firebase login example app #3946

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
49 changes: 49 additions & 0 deletions examples/firebase_login/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# Miscellaneous
*.class
*.log
*.pyc
*.swp
.DS_Store
.atom/
.build/
.buildlog/
.history
.svn/
.swiftpm/
migrate_working_dir/

# IntelliJ related
*.iml
*.ipr
*.iws
.idea/

# The .vscode folder contains launch configuration and tasks you configure in
# VS Code which you may wish to be included in version control, so this line
# is commented out by default.
#.vscode/

# Flutter/Dart/Pub related
**/doc/api/
**/ios/Flutter/.last_build_id
.dart_tool/
.flutter-plugins
.flutter-plugins-dependencies
.pub-cache/
.pub/
/build/

# Symbolication related
app.*.symbols

# Obfuscation related
app.*.map.json

# Android Studio will place build artifacts here
/android/app/debug
/android/app/profile
/android/app/release

# Firebase configurations
firebase.json
firebase_options.dart
42 changes: 42 additions & 0 deletions examples/firebase_login/.metadata
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# This file tracks properties of this Flutter project.
# Used by Flutter tool to assess capabilities and perform upgrades etc.
#
# This file should be version controlled and should not be manually edited.

version:
revision: "68415ad1d920f6fe5ec284f5c2febf7c4dd5b0b3"
channel: "stable"

project_type: app

# Tracks metadata for the flutter migrate command
migration:
platforms:
- platform: root
create_revision: 68415ad1d920f6fe5ec284f5c2febf7c4dd5b0b3
base_revision: 68415ad1d920f6fe5ec284f5c2febf7c4dd5b0b3
- platform: android
create_revision: 68415ad1d920f6fe5ec284f5c2febf7c4dd5b0b3
base_revision: 68415ad1d920f6fe5ec284f5c2febf7c4dd5b0b3
- platform: ios
create_revision: 68415ad1d920f6fe5ec284f5c2febf7c4dd5b0b3
base_revision: 68415ad1d920f6fe5ec284f5c2febf7c4dd5b0b3
- platform: macos
create_revision: 68415ad1d920f6fe5ec284f5c2febf7c4dd5b0b3
base_revision: 68415ad1d920f6fe5ec284f5c2febf7c4dd5b0b3
- platform: web
create_revision: 68415ad1d920f6fe5ec284f5c2febf7c4dd5b0b3
base_revision: 68415ad1d920f6fe5ec284f5c2febf7c4dd5b0b3
- platform: windows
create_revision: 68415ad1d920f6fe5ec284f5c2febf7c4dd5b0b3
base_revision: 68415ad1d920f6fe5ec284f5c2febf7c4dd5b0b3

# User provided section

# List of Local paths (relative to this file) that should be
# ignored by the migrate tool.
#
# Files that are not part of the templates will be ignored by default.
unmanaged_files:
- 'lib/main.dart'
- 'ios/Runner.xcodeproj/project.pbxproj'
28 changes: 28 additions & 0 deletions examples/firebase_login/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Firebase Login

Example flutter app built with Riverpod that demonstrates authentication with Firebase.

<table>
<tr>
<td><img src="./samples/demo.gif" alt="demo" width="320"></td>
<td><img src="./samples/error.png" alt="error" width="320"></td>
<td><img src="./samples/signup.png" alt="signup" width="320"></td>
<td><img src="./samples/home.png" alt="home" width="320"></td>
</tr>
</table>

## Features

- Sign up with Email and Password
- Sign in with Email and Password
- Sign in with Google
- Error handling

## Getting Started

1. Generate the native folders first by running `flutter create --platforms=android,ios,web,windows,macos .`
2. Create your firebase project, and enable email/password authentication and google.
3. Use [FlutterFire CLI](https://firebase.google.com/docs/flutter/setup?platform=ios) to connect the app with the firebase project.
4. Follow the [platform integration steps](https://pub.dev/packages/google_sign_in#platform-integration) for the `google_sign_in` package.
5. Run the app.
6. To run the tests, run `flutter test`.
Comment on lines +21 to +28
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Enhance the getting started section with prerequisites and detailed setup steps.

Consider expanding this section to include:

 ## Getting Started

+### Prerequisites
+
+- Flutter SDK (3.0.0 or higher)
+- Firebase CLI and FlutterFire CLI installed
+- A Firebase account
+
+### Setup Steps
+
 1. Generate the native folders first by running `flutter create --platforms=android,ios,web,windows,macos .`
 2. Create your firebase project, and enable email/password authentication and google.
+   - Go to Firebase Console
+   - Create a new project
+   - Navigate to Authentication section
+   - Enable Email/Password provider
+   - Enable Google Sign-in provider
+   - Configure OAuth consent screen
 3. Use [FlutterFire CLI](https://firebase.google.com/docs/flutter/setup?platform=ios) to connect the app with the firebase project.
+   ```bash
+   flutterfire configure
+   ```
 4. Follow the [platform integration steps](https://pub.dev/packages/google_sign_in#platform-integration) for the `google_sign_in` package.
 5. Run the app.
 6. To run the tests, run `flutter test`.
+
+### Troubleshooting
+
+If you encounter any issues:
+- Ensure all Firebase configuration files are properly generated
+- Verify SHA-1 fingerprint is correctly added to Firebase project (Android)
+- Check iOS bundle ID matches Firebase configuration

7 changes: 7 additions & 0 deletions examples/firebase_login/analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
include: ../analysis_options.yaml
# enable riverpod_lint
analyzer:
errors:
prefer_relative_imports: ignore
plugins:
- custom_lint
Loading
Loading