mirror of
https://github.com/nisrulz/flutter-examples.git
synced 2025-09-20 14:56:48 +08:00
Merge pull request #44 from v-b-r/patch-1
signInWithGoogle missing - FirebaseAuth
This commit is contained in:
@ -42,12 +42,13 @@ class AppState extends State<App> {
|
|||||||
try {
|
try {
|
||||||
googleSignIn = GoogleSignIn();
|
googleSignIn = GoogleSignIn();
|
||||||
GoogleSignInAccount googleSignInAccount = await googleSignIn.signIn();
|
GoogleSignInAccount googleSignInAccount = await googleSignIn.signIn();
|
||||||
GoogleSignInAuthentication gauth =
|
final GoogleSignInAuthentication gauth = await googleSignInAccount.authentication;
|
||||||
await googleSignInAccount.authentication;
|
final AuthCredential credential = GoogleAuthProvider.getCredential(
|
||||||
FirebaseUser user = await _auth.signInWithGoogle(
|
|
||||||
accessToken: gauth.accessToken,
|
accessToken: gauth.accessToken,
|
||||||
idToken: gauth.idToken,
|
idToken: gauth.idToken,
|
||||||
);
|
);
|
||||||
|
final AuthResult authRes = await _auth.signInWithCredential(credential);
|
||||||
|
final FirebaseUser user = authRes.user;
|
||||||
|
|
||||||
setState(() {
|
setState(() {
|
||||||
_username = user.displayName;
|
_username = user.displayName;
|
||||||
|
Reference in New Issue
Block a user