How to setup Google Authentication using React Native Expo
By: Aravind Kumar Vemula
Tags: Sign In With Google, Google Sign In, React Native, Google App Signing, Expo React Native

Follow the github page for source code: Google-Auth-Using-React-Expo

Steps to follows to use Google Sign In:

Open google and search for console.cloud.google.com and Sign In with your mail id.

After creating a account / Login into account, search for Create Credentials button and click on it

Now search for OAuth client Id and select it.

After selecting OAuth, under Application type search for android and select it.

Change the name of OAuth client to random or keep it default

to random or keep it default Now under Package name add “host.exp.exponent” as per the expo documentations.

add “host.exp.exponent” as per the expo documentations. Get the SHA-1 key if you have the key paste under SHA-1 signing certificate fingerprint in, if you don’t have the key then use this command to get the key “keytool -list -v -keystore (path to .android )\debub.keystore -alias androiddebugkey -storepass android -keypass android” , after that copy the SHA-1 key and paste it near SHA-1 signing certificate fingerprint and click create button to create a client id.

Creating a Project in Firebase

Open a new tab, search for firebase.google.com and create or login into your account

After login search for Go to Console button and click it that will redirect to console.firebase.google.com

I you haven’t create a project then click on Add Project, Enter your project name / App name to create a project and click continue. Now check weather the toggle is on or not, if not, on it and click on continue.

In the last step ( Choose or create a Google Analytics account) if you have an account select your account or select the default account for firebase and click Create project. Now it will create project, after project is created click continue.

if you have an account select your account or select the default account for firebase and click Create project. Now it will create project, after project is created click continue. Now select the web icon

Add a nickname to your app and uncheck the set up for Firebase Hosting. Then click on Register app button

the set up for Firebase Hosting. Then click on Register app button Now copy the firebaseConfig part with the apiKey,authDomain,etc. Now create a config.js file in your react project in the main tree and paste the firebaseConfig part in it.

Now on left side find the Authentication and select it.

Now go to sign-in methods and enable Email/Password and Google sign in

and enable Email/Password and Google sign in Under Google sign in, select your email id.

Now again go to the console.cloud.google.com/apis/credentials page and select your project and copy the Client Id from there

Now go to your firebase project page and under google sign in click on Web SDK configuration and paste the Client Id over there and there will be a default web client secret don’t change it for now.

Now go to LoginScreen.js page and paste the client id key near androidclientid

You need to have this package to access.

Install the package expo install expo-google-app-auth

Follow the github page for source code: Google-Auth-Using-React-Expo

Follow me in Github, Twitter, Linkedin.