this is my auth class
class Authentication {
final FirebaseAuth _auth = FirebaseAuth.instance;
final GoogleSignIn googleSignIn = GoogleSignIn();
Future<User?> signInWithGoogle() async {
try {
final GoogleSignInAccount? googleUser = await googleSignIn.signIn();
if (googleUser == null) {
// User canceled the sign-in process
print('User canceled Google Sign-In.');
return null; // Return null to indicate cancellation
}
final GoogleSignInAuthentication googleAuth =
await googleUser.authentication;
final AuthCredential credential = GoogleAuthProvider.credential(
accessToken: googleAuth.accessToken,
idToken: googleAuth.idToken,
);
final UserCredential userCredential =
await _auth.signInWithCredential(credential);
return userCredential.user;
} catch (e) {
print('Google sign-in error: $e');
return null;
}
}
Future<void> signOutGoogle() async {
await googleSignIn.signOut();
print("Google user signed out");
}
}
this is how its called inside a gesturedetector ontap
Authentication auth = Authentication();
User? user = await auth.signInWithGoogle();
And as soon as it gets clicked the App Crashes(iOS Simulator iPhone 15) and gives this error
flutter: Google sign-in error: PlatformException(google_sign_in, No active configuration. Make sure GIDClientID is set in Info.plist., NSInvalidArgumentException, null) Lost connection to device. Exited.
It was working fine for past 3 weeks and out of nowhere this error popped up idk how to handle this..
Add the client ID from the GoogleService-Info.plist into your app's [my_project]/ios/Runner/Info.plist file.
<key>GIDClientID</key>
<string>Copied from GoogleService-Info.plist key IOS CLIENT ID</string>
For more information visit the docs: https://pub.dev/packages/google_sign_in_ios
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