Using Firebase to sign in using Google
A social login is a method of authentication where the authentication is delegated to a trustworthy social networking service outside our app. A common social networking service that offers this kind of opportunity is Google.
In this recipe, you'll learn how to integrate a social login with Google using Firebase.
Getting ready
First, create a SwiftUI app called GoogleLogin
with Xcode. After creating it, configure the project following these steps:
- Add the Firebase SPM package:
Figure 12.21 – Adding the Firebase main package
- Then select the
FirebaseAuth
sub-package:Figure 12.22 – Adding the FirebaseAuth sub-package
- Add the
GoogleSignIn
SPM package, setting the URL to https://github.com/google/GoogleSignIn-iOS:
Figure 12.23 – Adding the GoogleSignIn SPM package
After configuring the project, create a FirebaseGoogleSignInApp
in Firebase following the steps in the recipe...