File tree Expand file tree Collapse file tree 1 file changed +3
-6
lines changed Expand file tree Collapse file tree 1 file changed +3
-6
lines changed Original file line number Diff line number Diff line change @@ -37,16 +37,13 @@ Ensure the "Google" sign-in provider is enabled on the [Firebase Console](https:
37
37
38
38
Future<UserCredential> signInWithGoogle() async {
39
39
// Trigger the authentication flow
40
- final GoogleSignInAccount? googleUser = await GoogleSignIn().signIn ();
40
+ final GoogleSignInAccount? googleUser = await GoogleSignIn.instance.authenticate ();
41
41
42
42
// Obtain the auth details from the request
43
- final GoogleSignInAuthentication? googleAuth = await googleUser? .authentication;
43
+ final GoogleSignInAuthentication googleAuth = googleUser.authentication;
44
44
45
45
// Create a new credential
46
- final credential = GoogleAuthProvider.credential(
47
- accessToken: googleAuth?.accessToken,
48
- idToken: googleAuth?.idToken,
49
- );
46
+ final credential = GoogleAuthProvider.credential(idToken: googleAuth.idToken);
50
47
51
48
// Once signed in, return the UserCredential
52
49
return await FirebaseAuth.instance.signInWithCredential(credential);
You can’t perform that action at this time.
0 commit comments