Skip to content

feat(google-auth): add forceAccountPicker option for explicit account selection#10

Merged
sbaiahmed1 merged 2 commits intomainfrom
fix/ios-signin-dialog
Dec 10, 2025
Merged

feat(google-auth): add forceAccountPicker option for explicit account selection#10
sbaiahmed1 merged 2 commits intomainfrom
fix/ios-signin-dialog

Conversation

@sbaiahmed1
Copy link
Copy Markdown
Owner

@sbaiahmed1 sbaiahmed1 commented Dec 10, 2025

resolves: #9
resolves: #8

  • Introduced a new forceAccountPicker parameter to skip silent sign-in.
  • Updated iOS implementation to handle this behavior.
  • Documented the new option in the TypeScript interface.

… selection

- Introduced a new `forceAccountPicker` parameter to skip silent sign-in.
- Updated iOS implementation to handle this behavior.
- Documented the new option in the TypeScript interface.
@sourcery-ai
Copy link
Copy Markdown

sourcery-ai bot commented Dec 10, 2025

Reviewer's Guide

Adds an iOS-level forceAccountPicker option that, when configured, bypasses silent sign-in and always presents the Google account picker, and documents this option in the TypeScript configuration interface.

Sequence diagram for iOS Google sign-in with forceAccountPicker

sequenceDiagram
    actor User
    participant ReactNativeApp
    participant NativeModule
    participant GoogleAuth
    participant GIDSignIn
    participant GoogleAccountPicker

    User->>ReactNativeApp: Initiate_google_sign_in()
    ReactNativeApp->>NativeModule: GoogleAuth_signIn()
    NativeModule->>GoogleAuth: signIn(resolve, reject)

    alt forceAccountPicker_enabled
        GoogleAuth->>GoogleAuth: check_forceAccountPicker
        GoogleAuth->>GoogleAccountPicker: performInteractiveSignIn(presentingViewController, resolve, reject)
        GoogleAccountPicker-->>GoogleAuth: user_selected_account(user)
        GoogleAuth->>NativeModule: resolve(user_data)
        NativeModule->>ReactNativeApp: return_user_data
        ReactNativeApp->>User: Show_signed_in_state
    else forceAccountPicker_disabled
        GoogleAuth->>GIDSignIn: restorePreviousSignIn(callback)
        alt silent_sign_in_success
            GIDSignIn-->>GoogleAuth: previous_user(user)
            GoogleAuth->>NativeModule: resolve(user_data)
            NativeModule->>ReactNativeApp: return_user_data
            ReactNativeApp->>User: Show_signed_in_state
        else silent_sign_in_failed_or_no_user
            GIDSignIn-->>GoogleAuth: error_or_nil
            GoogleAuth->>GoogleAccountPicker: performInteractiveSignIn(presentingViewController, resolve, reject)
            GoogleAccountPicker-->>GoogleAuth: user_selected_account(user)
            GoogleAuth->>NativeModule: resolve(user_data)
            NativeModule->>ReactNativeApp: return_user_data
            ReactNativeApp->>User: Show_signed_in_state
        end
    end
Loading

Updated class diagram for GoogleAuth and ConfigureParams

classDiagram
    class GoogleAuth {
        <<objc_class>>
        +static shared: GoogleAuth
        -isConfigured: Bool
        -configuredScopes: [String]
        -forceAccountPicker: Bool
        -init()
        +configure(params: NSDictionary, resolve: RCTPromiseResolveBlock, reject: RCTPromiseRejectBlock)
        +signIn(resolve: RCTPromiseResolveBlock, reject: RCTPromiseRejectBlock)
        -performInteractiveSignIn(presentingViewController: UIViewController, resolve: RCTPromiseResolveBlock, reject: RCTPromiseRejectBlock)
        -handleSignInSuccess(user: GIDGoogleUser, resolve: RCTPromiseResolveBlock)
        -getPresentingViewController(): UIViewController
    }

    class ConfigureParams {
        <<typescript_interface>>
        +iosClientId: string
        +webClientId: string
        +scopes: string[]
        +openIdRealm: string
        +forceAccountPicker: boolean
    }

    ConfigureParams <.. GoogleAuth : used_for_configuration
Loading

File-Level Changes

Change Details Files
Persist and use a forceAccountPicker flag in iOS GoogleAuth to control sign-in flow.
  • Introduce a new forceAccountPicker Boolean property on the GoogleAuth singleton with default false.
  • Read forceAccountPicker from configure params and store it on the instance when configuring, logging its value.
  • In the signIn method, when forceAccountPicker is true, bypass restorePreviousSignIn and immediately perform interactive sign-in with the presenting view controller.
ios/GoogleAuth.swift
Expose the forceAccountPicker configuration option in the TypeScript interface for consumers.
  • Extend ConfigureParams with an optional forceAccountPicker?: boolean field.
  • Document the behavior, default value, and iOS-only platform restriction for the new forceAccountPicker option.
src/NativeGoogleAuth.ts

Possibly linked issues


Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link
Copy Markdown

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey there - I've reviewed your changes - here's some feedback:

  • The forceAccountPicker flag is stored on the singleton at configuration time and then used for all subsequent sign-ins; consider making this a per-sign-in option (or resetting it after use) so one call with forceAccountPicker: true doesn’t unintentionally affect all future calls.
  • The new print statements for forceAccountPicker change runtime logging behavior; consider using a conditional or a dedicated logging mechanism so these messages don’t appear in production logs by default.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The `forceAccountPicker` flag is stored on the singleton at configuration time and then used for all subsequent sign-ins; consider making this a per-sign-in option (or resetting it after use) so one call with `forceAccountPicker: true` doesn’t unintentionally affect all future calls.
- The new `print` statements for `forceAccountPicker` change runtime logging behavior; consider using a conditional or a dedicated logging mechanism so these messages don’t appear in production logs by default.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

…tion guide

- Emphasized the requirement to use a Web OAuth client ID for `androidClientId`.
- Added detailed instructions and notes for Google Cloud Console setup.
- Updated troubleshooting section to address common configuration errors.
@sbaiahmed1 sbaiahmed1 merged commit 9e21458 into main Dec 10, 2025
5 of 6 checks passed
@sbaiahmed1 sbaiahmed1 deleted the fix/ios-signin-dialog branch December 10, 2025 08:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant