Created
January 13, 2020 16:55
-
-
Save Shubham-Narkhede/68cca6f59f8e34ec9600f67c1e255152 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
Future googleLogin() async { | |
final GoogleSignInAccount googleSignInAccount = await googleSignIn.signIn(); | |
final GoogleSignInAuthentication googleSignInAuthentication = | |
await googleSignInAccount.authentication; | |
final AuthCredential credential = GoogleAuthProvider.getCredential( | |
accessToken: googleSignInAuthentication.accessToken, | |
idToken: googleSignInAuthentication.idToken, | |
); | |
final AuthResult authResult = await _auth.signInWithCredential(credential); | |
final FirebaseUser user = authResult.user; | |
assert(!user.isAnonymous); | |
assert(await user.getIdToken() != null); | |
final FirebaseUser currentUser = await _auth.currentUser(); | |
return 'signInWithGoogle succeeded: $user'; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment