Last active
April 8, 2020 10:40
-
-
Save sirateek/27362e0c107559a20fdd409e63fd9b7e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
final GoogleSignIn googleSignIn = GoogleSignIn(); | |
final FirebaseAuth _auth = FirebaseAuth.instance; | |
Future<FirebaseUser> signInWithGoogle() async { | |
final GoogleSignInAccount googleUser = await googleSignIn.signIn(); | |
final GoogleSignInAuthentication googleAuth = await googleUser.authentication; | |
final AuthCredential credential = GoogleAuthProvider.getCredential( | |
idToken: googleAuth.idToken, accessToken: googleAuth.accessToken); | |
AuthResult authResult = await _auth.signInWithCredential(credential); | |
return authResult.user; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment