Skip to content

Base Providers - Authentication Module 2.0 #3639

Closed
10 of 10 issues completed
Closed

Description

@SandPod

Sub issue of #3126 that tracks the implementation of the base providers for the new authentication module.

Sub-issues

Sub-issues

10 of 10 Issues completed
Loading 10 sub-issues

Activity

  1. added
    area: authentication
    on Jun 12, 2025
  2. Floris29 commented on Jun 30, 2025

    @Floris29

    @tp Will the integration of Google and Apple auth be diffrent?

  3. 24 remaining items

  4. moved this from In Progress 🔥 to Next Up 🎯 in Serverpod Frameworkson Nov 12, 2025
  5. marcelomendoncasoares commented on Nov 14, 2025

    @marcelomendoncasoares
    Collaborator

    Hi @Floris29!

    Giving you a feedback on your request to simplify/centralize provider configuration, the solution that we have found was to expose platform specific configuration through optional environment variables - both for Google and Apple. This way, for those that do not want to set them directly on the code, it is possible to pass them during build using the --dart-define option.

    As an example, for the Google Sign-In we exposed the variables GOOGLE_CLIENT_ID and GOOGLE_SERVER_CLIENT_ID. If clientId and serverClientId values are not supplied when initializing the service on the code below, the provider will try to fetch them from the environment variables.

    /// If [clientId] and [serverClientId] are not provided, will try to load the
    /// values from `GOOGLE_CLIENT_ID` and `GOOGLE_SERVER_CLIENT_ID` environment
    /// variables, respectively. If the values are not provided by any means, an
    /// error will be thrown by the underlying [GoogleSignIn].
    ///
    /// The parameters [nonce] and [hostedDomain] are optional and will be passed
    /// directly to the [GoogleSignIn] initialize method. See the documentation
    /// of [GoogleSignIn.initialize] for more details.
    Future<void> initializeGoogleSignIn({
    String? clientId,
    String? serverClientId,
    String? nonce,
    String? hostedDomain,
    }) async {

    To run the app on Android, for example, you can do:

    flutter run \
      -d "<android_device>" \
      --dart-define="GOOGLE_CLIENT_ID=<android_client_id>.apps.googleusercontent.com" \
      --dart-define="GOOGLE_SERVER_CLIENT_ID=<web_client_id>.apps.googleusercontent.com"

    It is on the user to manage such environment variables and define which value to use for each platform, but no boilerplate is necessary on the code to forward platform specific configuration.

    Do you think this approach is enough for the kind of experience you were expecting?

  6. Floris29 commented on Nov 14, 2025

    @Floris29

    Hi @marcelomendoncasoares ,

    Thanks for getting back to me. This looks like a very good approach. Using optional environment variables keeps things flexible without adding extra code, and it fits well with how we manage platform-specific values during our builds. This solves the issue I had in mind.

    Thanks for taking the time to explain it!

  7. moved this from Next Up 🎯 to Done 🚀 in Serverpod Frameworkson Nov 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: authentication

    Type

    No type

    Projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions