Skip to content

Conversation

@exaby73
Copy link
Collaborator

@exaby73 exaby73 commented Jan 15, 2026

No description provided.

Copy link
Collaborator

@marcelomendoncasoares marcelomendoncasoares left a comment

Choose a reason for hiding this comment

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

Great work with the docs, @exaby73! Have a few suggestions for improvement mainly on the guide.

Copy link
Collaborator

@marcelomendoncasoares marcelomendoncasoares left a comment

Choose a reason for hiding this comment

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

Last two comments and we are good to go!

Comment on lines +17 to +32
1. Go to the [Firebase Console](https://console.firebase.google.com/) (create a new project if you don't have one)
2. Select your project
3. Navigate to **Project settings** > **Service accounts**
4. Click **Generate new private key**, then **Generate key**

![Service account](/img/authentication/providers/firebase/1-server-key.png)

This downloads a JSON file containing your service account credentials.

### Enable Authentication Methods

In the Firebase Console, enable the authentication methods you want to support:

1. Go to **Authentication** > **Sign-in method**
2. Enable your desired providers (Email/Password, Phone, Google, Apple, etc.)
3. Configure each provider according to Firebase's documentation
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggestion: For consistency, these two lists are missing the ending punctuation.

Comment on lines +150 to +183
## Integration patterns

### Using firebase_auth directly

For full control over the authentication UI, use the `firebase_auth` package directly. The basic flow is:

1. Build your own sign-in UI with text fields and buttons.
2. Call Firebase authentication methods (e.g., `signInWithEmailAndPassword`).
3. On success, pass the `firebase_auth.User` to `controller.login()`.
4. Handle errors from both Firebase and the Serverpod sync.

Refer to the [firebase_auth documentation](https://pub.dev/packages/firebase_auth) for available authentication methods.

### Using firebase_ui_auth

For a pre-built UI experience, use the `firebase_ui_auth` package. This provides ready-made screens for various authentication methods.

1. Add the package: `flutter pub add firebase_ui_auth`.
2. Use `firebase_ui.SignInScreen` with your desired providers.
3. Add `AuthStateChangeAction` handlers for `SignedIn` and `UserCreated` events.
4. In each handler, call `controller.login()` with the Firebase user.

```dart
actions: [
firebase_ui.AuthStateChangeAction<firebase_ui.SignedIn>((context, state) async {
final user = firebase_auth.FirebaseAuth.instance.currentUser;
if (user != null) {
await controller.login(user);
}
}),
],
```

Refer to the [firebase_ui_auth documentation](https://pub.dev/packages/firebase_ui_auth) for configuration details and available providers.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggestion: This section referencing the usage of firebase_ui_auth adds to the first (and may feel redundant by users that read the first one before). It is worth merging the two together instead of separating the explanation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants