Google Login (Using Firebase) #
- Open this link . Signup for a firebase account if you haven’t already. Login to Firebase console, setup a new project, or use an existing one.
- Create a native iOS app using the
ios.bundleIdentifieryou defined in app.json file (for ios), and an Android app using theandroid.package. (for android)
- (Android only) Go to your Firebase project’s settings, scroll down to “Your apps” and select your Android app. Under
SHA certificate fingerprints, clickAdd fingerprint, and addGoogle Certificate Fingerprint.
You’ll getGoogle Certificate Fingerprintby following steps:
(You need to build your app once before these steps to generate credentials)
– runeas credentials
– Select Android
– Select profile (production)
– You’ll get all the credentials in the console. From here copy the “SHA1 Fingerprint“. This SHA1 Fingerprint isGoogle Certificate Fingerprint.
*** If you haven’t already runeas build -p androidfor this project, you’ll need to do that first before getting the Google Certificate Fingerprint. - Now go to firebase “Project Overview” and click “+ Add app” button under your project name to add a new web app.

Now select the “</>” for web platform
Give it a name and click “Register app”
Click “Continue to console”
- Download the
GoogleService-Info.plist(iOS) & thegoogle-services.json(Android) from your Firebase project settings page. Move them to your app’s root folder.


- (iOS only) Also in app.json, set
expo.ios.googleServicesFileto the relative path of yourGoogleService-Info.plist. - (Android Only) And also in app.json, set
expo.android.googleServicesFileto the relative path of yourgoogle-services.json.
at this stage your app.json file will have the following
// app.json
{
"expo": {
....,
"ios": {
"bundleIdentifier": "com.yourapp",
"googleServicesFile": "./GoogleService-Info.plist",
....
},
"android": {
"package": "com.yourapp",
"googleServicesFile": "./google-services.json",
....
},
....
}
}

8. Now Run following commandnpx expo install @react-native-google-signin/google-signin@14.0.1
9. Open screens > LoginScreen.jsx and remove “//” (see below image)

10. Open screens > AccountScreen.jsx and remove “//” (see below image)

11. Open app.json file and insert the following line in the expo > plugins array"@react-native-google-signin/google-signin",
12. Finally open your google-services.json file and copy the client_id which has “client_type” : 3 in the next line. Now open project > app > services > socialLoginConfig.js file. Now paste the value under webClientId. And make sure to put the value of enabled to true and include ‘google‘ to the platforms array. Also put the value of enable as true . See the image.

13. Now go to firebase project setting and add Support email. This is very important.
14. After configuring Google Login, please create a new build and test with that. Older build will produce errors.
15. After you upload the app in play store and get approved, you need to log in to your play console account and select your published app. On the next page select “App Signing” under “Setup” option from the left sidebar. Scroll down to “App signing key certificate” You’ll see something like the image below. Copy the “SHA-1 certificate fingerprint” under “App signing key certificate”.
Go to your firebase project, open the android app you created in step 2. Now add the “SHA-1 certificate fingerprint” to your project.
Similarly Copy the “SHA-256 certificate fingerprint” And add it to firebase project.
If you miss this step, google signin will not work in the app downloaded from play store.
