diff --git a/docs/auth/federated-auth.md b/docs/auth/federated-auth.md index 218634ac0960..943505bdc4ce 100644 --- a/docs/auth/federated-auth.md +++ b/docs/auth/federated-auth.md @@ -37,16 +37,13 @@ Ensure the "Google" sign-in provider is enabled on the [Firebase Console](https: Future signInWithGoogle() async { // Trigger the authentication flow - final GoogleSignInAccount? googleUser = await GoogleSignIn().signIn(); + final GoogleSignInAccount? googleUser = await GoogleSignIn.instance.authenticate(); // Obtain the auth details from the request - final GoogleSignInAuthentication? googleAuth = await googleUser?.authentication; + final GoogleSignInAuthentication googleAuth = googleUser.authentication; // Create a new credential - final credential = GoogleAuthProvider.credential( - accessToken: googleAuth?.accessToken, - idToken: googleAuth?.idToken, - ); + final credential = GoogleAuthProvider.credential(idToken: googleAuth.idToken); // Once signed in, return the UserCredential return await FirebaseAuth.instance.signInWithCredential(credential);