I am using google_sign_in plug in.
It is working good. but I have a problem.
I need to send idToken to backend server to verify a user.
But IdToken is null from google sign in response.
code is simple
final GoogleSignInAccount googleUser = await _googleSignIn.signIn();
final GoogleSignInAuthentication googleAuth =
await googleUser.authentication;
print("Printing google user info");
print(googleAuth.accessToken);
print(googleAuth.idToken);
print(googleUser.displayName);
Other properties have a correct value. but idToken is null
I googled for this and says that I need to web client id.
So I did
final _googleSignIn = GoogleSignIn(clientId: webClientId);
Can you guys help?
Am I missing something?
https://firebase.google.com/docs/flutter/setup
I faced with this Problem for two days and finally. (in my case) this solution works.
https://firebase.flutter.dev/docs/installation/android#installing-your-firebase-configuration-file
adding com.google.gms:google-services as a dependency inside of the android/build.gradle
dependencies {
// ... other dependencies
classpath 'com.google.gms:google-services:4.3.8'
}
}
adding apply plugin: 'com.google.gms.google-services' in /android/app/build.gradle
apply plugin: 'com.google.gms.google-services'
Hi after a long time i although found a solution.
In short there was a problem with the Firebase setup, which doesn't occure because i used:
await Firebase.initializeApp(options:
defaultFirebaseOptions.currentPlatform);
Which makes my code work but hide the real failure, which occurs when i just use:
await Firebase.initializeApp();
But actually the first approach is the better one but long story short.
There is something wrong with the firebase sdk setup. Follow this official tutorial for setup first: https://firebase.google.com/docs/android/setup
Now i did not worked. But if i changed the build.gradle (root / project) from:
plugins {
id 'com.google.gms.google-services' version '4.4.0' apply false
}
to
plugins {
id 'com.google.gms.google-services' version '4.3.15' apply false
}
it worked. Does this make sense? For me not. Am i happy that it works now? Yes :)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With