You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
google_sign_in 7.1.0 required serverClientId for Android #172073
Hello everyone, I just upgraded google_sign_in from 6.2.2 to 7.1.0 and encountered this error:
GoogleSignInException(code GoogleSignInExceptionCode.clientConfigurationError, serverClientId must be provided on Android, null
I managed to fix this issue by providing my web client ID instead of the Android one.
What I don't understand is that in the integration docs, it stated that I don't need serverClientId if I already provided google-services.json
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 initialising the GoogleSignIn instance.
Hope anyone can help me understand more about this issue and clear up any misunderstanding on my side.
Please provide complete details about your configuration, since without that there's no way for us to know whether that error message is expected or not. In particular:
When you do a debug build of your app, do you have a build/app/generated/res/processDebugGoogleServices/values/values.xml containing default_web_client_id?
Also, are you ensuring that your initialize() has completed before calling your signIn() method? You aren't declaring it as returning a Future, which suggests that you aren't awaiting its completion.
I ran into this today I was able to solve this by passing the serverClientId (aka client_id from Google cloud console). Anyone running into this issue initlialize the GoogleSignIn instance with a serverClientId before accessing other apis
@stuartmorgan-g I can't find build/app/generated/res/processDebugGoogleServices/values/values.xml in my project.
You are correct that I did not ensure initialize() completed before calling signIn(). So I tried to await the initialisation then immediately call the signIn method and still managed to reproduce the same error
I can't find build/app/generated/res/processDebugGoogleServices/values/values.xml in my project.
Are you using Firebase for anything other than the google_sign_in configuration? It sounds like this step may not be configured correctly for your project.
( 3879): Error during sign in: GoogleSignInException(code GoogleSignInExceptionCode.clientConfigurationError, serverClientId must be provided on Android, null)
I have the google-services.json file, and I'm using the Google Sign In directly instead of using the Firebase Auth. I have added the iOS and Android OAuth clients, and I do not have a server/website.
I can't find build/app/generated/res/processDebugGoogleServices/values/values.xml in my project.
Are you using Firebase for anything other than the google_sign_in configuration? It sounds like this step may not be configured correctly for your project.
I also use Firebase for Crashlytics and it works fine.
My project structure looks different from the setup, maybe due to an old project. I will try to reproduce this in a newly created project.
Thank you @maheshj01 for the clear step by step explanations, they solved this error. It is strange we have to hardcode the client id, but if thats the way then so be it.
I faced the same issue when migrating from 6.1.2 to 7.1.1.
The solution that worked for me was running the following command :
dart pub global activate flutterfire_cli
This updates flutterfire_cli to the latest version. After that, I re-ran the FlutterFire configuration, which regenerated the google-services.json file along with the required folders, and that fixed the bug
I faced the same issue when migrating from 6.1.2 to 7.1.1. The solution that worked for me was running the following command :
dart pub global activate flutterfire_cli
This updates flutterfire_cli to the latest version. After that, I re-ran the FlutterFire configuration, which regenerated the google-services.json file along with the required folders, and that fixed the bug
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.
Activity
stuartmorgan-g commentedon Jul 13, 2025
Please provide complete details about your configuration, since without that there's no way for us to know whether that error message is expected or not. In particular:
initializeand the call that threw that exception?adibzter commentedon Jul 13, 2025
Yes, I followed the setup instructions.
The code below is called in the main function
When the code below is called, the error I mentioned is thrown
It works if I initialise it with
serverClientIdstuartmorgan-g commentedon Jul 13, 2025
When you do a debug build of your app, do you have a
build/app/generated/res/processDebugGoogleServices/values/values.xmlcontainingdefault_web_client_id?Also, are you ensuring that your
initialize()has completed before calling yoursignIn()method? You aren't declaring it as returning aFuture, which suggests that you aren't awaiting its completion.maheshj01 commentedon Jul 13, 2025
I ran into this today I was able to solve this by passing the serverClientId (aka client_id from Google cloud console). Anyone running into this issue initlialize the GoogleSignIn instance with a
serverClientIdbefore accessing other apisCopy the Client ID listed there — this is your serverClientId.
and then use the other apis
adibzter commentedon Jul 14, 2025
@stuartmorgan-g I can't find
build/app/generated/res/processDebugGoogleServices/values/values.xmlin my project.You are correct that I did not ensure
initialize()completed before callingsignIn(). So I tried to await the initialisation then immediately call thesignInmethod and still managed to reproduce the same errorGoogleSignInException(code GoogleSignInExceptionCode.clientConfigurationError, serverClientId must be provided on Android, null)stuartmorgan-g commentedon Jul 14, 2025
Are you using Firebase for anything other than the
google_sign_inconfiguration? It sounds like this step may not be configured correctly for your project.asadamatic commentedon Jul 14, 2025
I just faced the same issue with version 7.0.1.
I have the
google-services.jsonfile, and I'm using the Google Sign In directly instead of using the Firebase Auth. I have added the iOS and Android OAuth clients, and I do not have a server/website.adibzter commentedon Jul 14, 2025
I also use Firebase for Crashlytics and it works fine.
My project structure looks different from the setup, maybe due to an old project. I will try to reproduce this in a newly created project.
16 remaining items
[google_sign_in] Add more serverClientId info to README (flutter#9629)
giorgio79 commentedon Jul 30, 2025
Thank you @maheshj01 for the clear step by step explanations, they solved this error. It is strange we have to hardcode the client id, but if thats the way then so be it.
akurnaz commentedon Jul 30, 2025
If we need to call the initialize method before authenticate, then the code example in this documentation is misleading.
https://firebase.google.com/docs/auth/flutter/federated-auth#google
[google_sign_in] Add more serverClientId info to README (flutter#9629)
sagarehs commentedon Aug 7, 2025
belh-sara commentedon Aug 21, 2025
I faced the same issue when migrating from 6.1.2 to 7.1.1.
The solution that worked for me was running the following command :
dart pub global activate flutterfire_cliThis updates flutterfire_cli to the latest version. After that, I re-ran the FlutterFire configuration, which regenerated the google-services.json file along with the required folders, and that fixed the bug
bazl-E commentedon Aug 27, 2025
this works
gabuldev commentedon Sep 1, 2025
I solved the problem using the explanation and using an Android emulator with the Play Store. For now, works fine in debug for me.
Musab-Edzok commentedon Sep 2, 2025
I solved it by adding this in main.dart
await GoogleSignIn.instance.initialize();If this doesn't work try creating OAuth client ID and add your app and SHA1 key, if already exists then try updating SHA1 key by performing
cd android.\gradlew signingReportfrom your project terminal
github-actions commentedon Sep 16, 2025
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of
flutter doctor -vand a minimal reproduction of the issue.[google_sign_in] Add more serverClientId info to README (flutter#9629)
[google_sign_in] Add more serverClientId info to README (flutter#9629)