feat(ui_oauth_google)!: migrate to google_sign_in 7 - #689
Conversation
There was a problem hiding this comment.
Code Review
This pull request upgrades the google_sign_in dependency to version ^7.1.0 and introduces support for serverClientId in GoogleSignInButton, GoogleSignInIconButton, and GoogleProvider. It refactors GoogleProvider to align with the new plugin API, separating authentication and authorization steps and adding initialization logic. Feedback suggests exposing a @visibleForTesting method to reset the static _initialization state to ensure test isolation, as well as simplifying the _ensureInitialized method by chaining the .catchError call directly.
Chain the retry-reset catchError directly onto initialize() instead of threading an intermediate local, and add a @VisibleForTesting debugReset() that clears the static one-time-init future so each test starts from a clean state with its freshly injected mock. Addresses review feedback on firebase#689.
|
Pushed a couple of follow-ups to get CI green:
The new workflow runs are showing |
7271909 to
2578afa
Compare
|
CI update #692 has landed on Correcting my earlier note: the I'm rebasing onto latest This will be the first run where |
Migrates GoogleProvider to the google_sign_in 7 API, which adopts the UIScene lifecycle on iOS (google_sign_in_ios 6.3.0) and Swift Package Manager (6.3.3). Fixes the deprecated application lifecycle warning tracked in firebase#673. - GoogleSignIn is now the shared instance and is initialized once before the first sign-in. - Authentication and authorization are separate steps. The provider reuses an existing authorization for the requested scopes and prompts for consent when one is not available, so the credential still carries an access token when scopes are requested. - A cancelled sign-in surfaces as AuthCancelledException, matching the previous flow reset behaviour. - Adds an optional serverClientId parameter to GoogleProvider, GoogleSignInButton and GoogleSignInIconButton for Android apps that do not use google-services.json. - Updates the integration test mocks to the new API. BREAKING CHANGE: consumers must follow the google_sign_in 7 platform integration steps: GIDClientID in Info.plist on iOS, and on Android a web OAuth client entry in google-services.json or an explicit serverClientId. When no scopes are requested the credential now contains only an ID token.
Chain the retry-reset catchError directly onto initialize() instead of threading an intermediate local, and add a @VisibleForTesting debugReset() that clears the static one-time-init future so each test starts from a clean state with its freshly injected mock. Addresses review feedback on firebase#689.
2578afa to
b75da95
Compare
|
The rebased run is green on web, Android and macOS. iOS came back red on a single test — The google_sign_in 7 path itself passed on iOS, including "signs the user in" and "works standalone" ( I don't have re-run rights on the repo as an external contributor — could a maintainer kick off a re-run of the iOS job when convenient? Happy to rebase again if you'd prefer that to re-trigger it. |
Description
Migrates
firebase_ui_oauth_googlefrom google_sign_in 6.x to 7.x.google_sign_in 6.x pins apps to google_sign_in_ios 5.x, which still uses the deprecated UIApplication delegate lifecycle. Moving to 7.x resolves google_sign_in_ios 6.3.x, which adopted the UIScene lifecycle in 6.3.0 and added a Swift Package Manager target in 6.3.3. This clears the FLTGoogleSignInPlugin deprecation warning that iOS apps currently log on startup.
What changed:
GoogleProvidernow uses the sharedGoogleSignIn.instanceand initializes it once before the first sign-in.authorizationForScopesand falls back toauthorizeScopes, so the resulting Firebase credential still carries an access token as it did in 6.x. When no scopes are requested the credential contains only an ID token, which is all Firebase Auth needs.GoogleSignInExceptionCode.canceled) is surfaced asAuthCancelledException, so the auth flow resets exactly as before.serverClientIdparameter onGoogleProvider,GoogleSignInButtonandGoogleSignInIconButton. On Android an ID token requires a server client ID. Apps that usegoogle-services.jsoncontaining a web OAuth client entry need no change; other apps can now pass it explicitly.The constraint is
^7.1.0because 7.1.0 added theGoogleSignInExceptionCodeexport needed for structured cancel handling.Verified locally on the workspace:
dart analyzereports no problems,firebase_ui_oauth(7/7) andfirebase_ui_auth(69/69) test suites pass, and thetestspackage compiles against the migrated API.Related Issues
Fixes #673. Related to the wider UIScene migration alongside #672 / #676.
Checklist
Before you create this PR confirm that it meets all requirements listed below by checking the relevant checkboxes (
[x]).This will ensure a smooth and quick review process. Updating the
pubspec.yamland changelogs is not required.///).melos run analyze) does not report any problems on my PR.melos run test:unit:alldoesn't fail).Breaking Change
Does your PR require plugin users to manually update their apps to accommodate your change?
Consumers must follow the google_sign_in 7 platform integration steps:
GIDClientIDin Info.plist on iOS, and on Android a web OAuth client entry ingoogle-services.jsonor an explicitserverClientId. This package would therefore need a major version bump.