File tree Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -41,13 +41,15 @@ class AppState extends State<App> {
41
41
FirebaseAuth _auth = FirebaseAuth .instance;
42
42
try {
43
43
googleSignIn = GoogleSignIn ();
44
- GoogleSignInAccount googleSignInAccount = await googleSignIn.signIn ();
45
- GoogleSignInAuthentication gauth =
46
- await googleSignInAccount .authentication;
47
- FirebaseUser user = await _auth. signInWithGoogle (
48
- accessToken: gauth .accessToken,
49
- idToken: gauth .idToken,
44
+ GoogleSignInAccount googleUser = await googleSignIn.signIn ();
45
+ final GoogleSignInAuthentication googleAuth =
46
+ await googleUser .authentication;
47
+ final AuthCredential credential = GoogleAuthProvider . getCredential (
48
+ accessToken: googleAuth .accessToken,
49
+ idToken: googleAuth .idToken,
50
50
);
51
+ final AuthResult authRes = await _auth.signInWithCredential (credential);
52
+ final FirebaseUser user = authRes.user;
51
53
52
54
setState (() {
53
55
_username = user.displayName;
You can’t perform that action at this time.
0 commit comments