Google Sign In Authenticate with Google using FlutterFire

This lesson is available for PRO members or as a single course purchase. Sign-in and choose a plan below.
Get Unlimited PRO Access


*Enrollment provides full access to this course (and updates) for life.

Auth Service

Implement Google Login in the auth service.

file_type_flutter services/auth.dart
import 'package:firebase_auth/firebase_auth.dart';
import 'package:google_sign_in/google_sign_in.dart';

class AuthService {

  // ...

  Future<void> googleLogin() async {
    try {
      final googleUser = await GoogleSignIn().signIn();

      if (googleUser == null) return;

      final googleAuth = await googleUser.authentication;
      final authCredential = GoogleAuthProvider.credential(
        accessToken: googleAuth.accessToken,
        idToken: googleAuth.idToken,

      await FirebaseAuth.instance.signInWithCredential(authCredential);
    } on FirebaseAuthException catch (e) {
        // handle error


Login Screen

Add Google Sign In to the login screen column.

file_type_flutter login.dart
        text: 'Sign in with Google',
        loginMethod: AuthService().googleLogin,


Ask questions via GitHub below OR chat on Slack #questions