From eaec1e10e2449174159cbda156b83f581ae4b338 Mon Sep 17 00:00:00 2001 From: Stuart Morgan Date: Tue, 15 Jul 2025 10:14:36 -0400 Subject: [PATCH 1/2] [google_sign_in] Add more serverClientId info to README When I wrote the docs I thought that Firebase would always include a web OAuth client ID, but it appears that this is not always the case (e.g., https://stackoverflow.com/questions/55572583/google-services-json-missing-client-type-3) so this adds more docs about what is required for this to work correctly. Also adds a note that a missing ID error could be due to incorrect gradle configuration, as that's not necessarily clear from the Firebase docs. Fixes https://github.com/flutter/flutter/issues/172073 --- .../google_sign_in_android/CHANGELOG.md | 5 +++++ .../google_sign_in_android/README.md | 15 +++++++++++++-- .../google_sign_in_android/pubspec.yaml | 2 +- 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/packages/google_sign_in/google_sign_in_android/CHANGELOG.md b/packages/google_sign_in/google_sign_in_android/CHANGELOG.md index fa5c921d345..7a6917bc038 100644 --- a/packages/google_sign_in/google_sign_in_android/CHANGELOG.md +++ b/packages/google_sign_in/google_sign_in_android/CHANGELOG.md @@ -1,3 +1,8 @@ +## 7.0.3 + +* Add more details and troubleshooting for `serverClientId` configuration + via Firebase. + ## 7.0.2 * Adds a README note about potentially confusing error returns from diff --git a/packages/google_sign_in/google_sign_in_android/README.md b/packages/google_sign_in/google_sign_in_android/README.md index 51759177dad..2ff95a6fbb1 100644 --- a/packages/google_sign_in/google_sign_in_android/README.md +++ b/packages/google_sign_in/google_sign_in_android/README.md @@ -22,7 +22,8 @@ To use Google Sign-In, you'll need to register your application, either * If you are use the `google-services.json` file and Gradle-based registration system, no identifiers need to be provided in Dart when initializing the - `GoogleSignIn` instance when running on Android. + `GoogleSignIn` instance when running on Android, as long as your + `google-services.json` contains a web OAuth client entry. * If you are not using `google-services.json`, you need to pass the client ID of the *web* application you registered as the `serverClientId` when initializing the `GoogleSignIn` instance. @@ -51,6 +52,16 @@ errors include: * Sign-in working in one build configuration but not another. Common sources of configuration errors include: -* Missing or incorrect `serverClientId`. * Missing or incorrect signing SHA for one or more build configurations. * Incorrect Android package name on the server side. +* Missing or incorrect `serverClientId`. + +If you are using `google-services.json` and recieve a "serverClientId must be +provided on Android" error message, check that: + * Your `google-services.json` contains a web OAuth client, which should be an + `oauth_client` entry with `client_type: 3`. This should have been created + automatically when enabling Google Sign In using the Firebase console, but + if not (or if it was later removed), add a web app to the project and then + re-download `google-services.json`. + * You correctly added followed all of the Gradle configuration steps in the + Firebase integration documentation. diff --git a/packages/google_sign_in/google_sign_in_android/pubspec.yaml b/packages/google_sign_in/google_sign_in_android/pubspec.yaml index dcb635d2a01..0628fad0ee2 100644 --- a/packages/google_sign_in/google_sign_in_android/pubspec.yaml +++ b/packages/google_sign_in/google_sign_in_android/pubspec.yaml @@ -2,7 +2,7 @@ name: google_sign_in_android description: Android implementation of the google_sign_in plugin. repository: https://github.com/flutter/packages/tree/main/packages/google_sign_in/google_sign_in_android issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+google_sign_in%22 -version: 7.0.2 +version: 7.0.3 environment: sdk: ^3.6.0 From 091167fb05f9011627f5a2a4643406479f122183 Mon Sep 17 00:00:00 2001 From: Stuart Morgan Date: Wed, 16 Jul 2025 08:13:53 -0400 Subject: [PATCH 2/2] Fix bad edit --- packages/google_sign_in/google_sign_in_android/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/google_sign_in/google_sign_in_android/README.md b/packages/google_sign_in/google_sign_in_android/README.md index 2ff95a6fbb1..dec0aaa10c2 100644 --- a/packages/google_sign_in/google_sign_in_android/README.md +++ b/packages/google_sign_in/google_sign_in_android/README.md @@ -63,5 +63,5 @@ provided on Android" error message, check that: automatically when enabling Google Sign In using the Firebase console, but if not (or if it was later removed), add a web app to the project and then re-download `google-services.json`. - * You correctly added followed all of the Gradle configuration steps in the - Firebase integration documentation. + * You correctly followed all of the Gradle configuration steps in the Firebase + integration documentation.