Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ Finally, start the server with `serverpod start` to generate the client code, th
- `appId`: Required. The App ID of your Facebook App.
- `appSecret`: Required. The App secret of your Facebook App.

For more details on configuration options, see the [configuration section](./configuration).
For more details on configuration options, see the [customizations section](./customizations).

## Client-side configuration

Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
---
sidebar_label: Configuration
description: Facebook identity provider options include custom validation of account details before sign-in. Configure them beyond the basic setup.
sidebar_label: Customizations
description: Sign in with Facebook can be configured through FacebookIdpConfig, including how to load credentials and use the available callbacks.
---

# Configure Facebook sign-in
# Customize Facebook sign-in

This page covers configuration options for the Facebook identity provider beyond the basic setup.
This page covers additional configuration options for the Facebook identity provider beyond the basic setup.

## Configuration options

Expand Down Expand Up @@ -125,7 +125,7 @@ final facebookIdpConfig = FacebookIdpConfigFromPasswords(
);
```

### Reacting to account creation
### Reacting to Facebook account creation

You can use the `onAfterFacebookAccountCreated` callback to run logic after a new Facebook account has been created and linked to an auth user. This callback is only invoked for new accounts, not for returning users.

Expand All @@ -152,11 +152,11 @@ This callback runs inside the same database transaction as the account creation.
If you need to assign Serverpod scopes based on provider account data, note that updating the database alone (via `AuthServices.instance.authUsers.update()`) is **not enough** for the current login session. The token issuance uses the in-memory `authUser.scopes`, which is already set before this callback runs. You would need to update `authUser.scopes` as well for the scopes to be reflected in the issued tokens. For assigning scopes at creation time, consider using `onBeforeAuthUserCreated` in combination with `getExtraFacebookInfoCallback` to fetch and store the data you need before the auth user is created.
:::

## Configuring Facebook Sign-In on the app
### Configuring Facebook sign-in on the app

When using the external `serverpod_auth_idp_flutter_facebook` package, you can configure the App ID in your Flutter application.

### Passing configuration in code
#### Passing configuration in code

You can pass the App ID directly when initializing the Facebook Sign-In service:

Expand All @@ -168,7 +168,7 @@ await client.auth.initializeFacebookSignIn(

If the `appId` value is not supplied when initializing the service, the provider will automatically fetch it from the `FACEBOOK_APP_ID` environment variable. This approach is useful for different configurations per platform or build environment.

### Using environment variables
#### Using environment variables

Alternatively, you can pass the App ID during build time using the `--dart-define` option. The Facebook Sign-In provider supports the following environment variable:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ import 'package:serverpod_auth_idp_flutter_facebook/serverpod_auth_idp_flutter_f
FacebookSignInWidget(
client: client,
// Button customization
text: FacebookButtonText.continueWith, // or signIn, signInWith, signUp
type: FacebookButtonType.standard, // or icon
type: FacebookButtonText.continueWith, // or signinWith, signupWith, signIn
style: FacebookButtonStyle.blue, // or white
size: FacebookButtonSize.large, // or medium
shape: FacebookButtonShape.pill, // or rectangular, rounded
logoAlignment: FacebookButtonLogoAlignment.left, // or center
size: FacebookButtonSize.large, // or medium, small
shape: FacebookButtonShape.pill, // or rectangular
logoAlignment: FacebookButtonLogoAlignment.center, // or left
minimumWidth: 240, // in pixels, max 400

// Permissions to request from Facebook
// These are the default permissions.
Expand Down
Loading