
Repository
https://github.com/firebase/firebase-ios-sdk
What Will I Learn?
- You will learn how to create a Google Sign In button in one of your view controllers in your iOS app.
- You will learn how to enable users to sign into your iOS app with Google account.
- You will learn about Firebase Authentication.
- You will learn to work with GIDSignInDelegate to handle situations such as successful or failed sign in attempts.
- You will learn how to create a sign out button for the user to log out of the app.
Requirements
- A Mac running macOS 10.13.2 High Sierra or later
- Xcode 9.3.1 or later installed
- Latest version of Cocoapods installed
- A real iOS device running iOS 11 or later or iOS simulator included in Xcode for testing
- A Firebase iOS app created in Firebase console if not using starter project below
Before you begin
Download starter project for this video here
Required knowledge
- A little understanding with Cocoapods
- A little understanding with UI elements in iOS
- Fair understanding with the Swift programming language
- Fair understanding with the user interface of Xcode IDE
Difficulty
Intermediate
Resources
Firebase website: https://firebase.google.com
Firebase documentation: https://firebase.google.com/docs/
Adding Firebase to Xcode project: https://firebase.google.com/docs/ios/setup?authuser=0
Intro to Firebase Authentication: https://firebase.google.com/docs/auth/
Intro to Firebase Authentication in iOS: https://firebase.google.com/docs/auth/ios/start
Firebase documentation on Google Sign In on iOS: https://firebase.google.com/docs/auth/ios/google-signin
Firebase Auth error handling: https://firebase.google.com/docs/auth/ios/errors
Google sign in documentation: https://developers.google.com/identity/sign-in/ios?authuser=0
Firebase iOS SDK Github repository: https://github.com/firebase/firebase-ios-sdk
Overview
In this video, we will be talking about how you can allow your users to sign into your Firebase iOS app with their Google accounts. We will be taking a look at how we can add a button in a view controller to allow the user to tap onto it so that they can sign in. By tapping that button, we will present a view controller that allows the user to enter their username and password of their Google accounts in order to sign in. Depending on whether if the sign in was a success or a failure, we will work with the GIDSignInDelegate to handle both situations. For example, if the sign in was a success, we want to display another view controller, but if the sign in was a failure for any reason, we want to display an alert for the user, letting them know that there is something wrong.
Creating a sign in button
In this tutorial we’re using storyboard to create our user interface. According to Firebase’s documentation, we’re inserting a UIView into the view controller, then we set its UIView custom class to GIDSignInButton. Note that the button won’t appear in the storyboard file, you have to run the app in order to see the button.
Sign into iOS app with Google account
The GIDSignInButton is designed so that when we click on that button, without the need to call the sign in function manually, it will present a view controller where we can sign into a Google account, with a familiar Google sign in interface. After successful sign in, we obtain the credentials then authenticate into our Firebase application.
Signing out
A simple do-catch statement in the IBAction method of our sign out button will sign us out of the Firebase application quickly when the user taps on the button when signed in.
DTube Video tutorial

Source code
You may download the source code of the final project for reference here
TechCoderX’s Firebase tutorial series
All previous Firebase episodes are made before my transition from YouTube to DTube, so my Firebase YouTube video tutorial links for episode 1 to 8 are included here.
- Set up Firebase for the first time
- Saving and retrieving data from and to Firebase realtime database
- Firebase Database Persistence
- Firebase Authentication with Facebook login
- Deleting data from Firebase realtime database
- Firebase Authentication with Twitter login
- Firebase Authentication with email and password
- Firebase Crashlytics Basics
Proof of work done
▶️ DTube
▶️ IPFS