Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- final FirebaseAuth _auth = FirebaseAuth.instance;
- // GoogleSignIn is a specific sign in class.
- final GoogleSignIn _googleSignIn = GoogleSignIn();
- // Try to sign in the user.
- // This method will either log in a user that your Firebase
- // is aware of, or it will prompt the user to log in
- // if its the first time.
- //
- GoogleSignInAccount googleUser = await _googleSignIn.signIn();
- GoogleSignInAuthentication googleAuth = await googleUser.authentication;
- AuthCredential authCredential = GoogleAuthProvider.getCredential(
- idToken: googleAuth.idToken, accessToken: googleAuth.accessToken);
- // After checking for authentication,
- // We wil actually sign in the user
- // using the token that firebase.
- user = await _auth.signInWithCredential(authCredential);
Add Comment
Please, Sign In to add comment