Google Sign-in Configuration

📘

Overview

Google Sign-in Configuration will be done in three steps:

A. Create your Google Cloud Project

Create an app in the Google Developer portal and add Google Login capability.

B. Configure iOS

Configure your Google app to support iOS based on Bundle ID.

C. Configure Android.

Configure your Google app to support Android based on Package Name and signing key. Note: If you are building your application from multiple machines you will need to create an OAuth client ID and provide the SHA-1 Certificate fingerprint used by each machine.

🚧

Already have a Google app?

If you already have an existing Google app you may skip to iOS Configuration or Android Configuration configuration steps below.**

A. Create your Cloud Project

Step A1. Log in and create a new cloud project.

Log into your account. Under the "New Project" page, name your project by entering a name in the field indicated. For example, see "MynewApp" in green box below.

28722872

Log into your Google Platform Account and create a new project.



Step A2. Configure OAuth consent screen.

Next, we are going to configure "OAuth consent screen" in seven steps.

(i) Confirm that your current project is selected. See red box in image below.
(ii) Mouse over API and Services and then select "OAuth consent screen" as shown in green box in image below.

28702870

Configure user type.



(iii) Choose whether the user type should be internal or external. Then click "Create"

28802880

Choose internal or external. Then click "Create"

(iv) Continuing with OAuth consent screen but now editing app registration. As indicated in the green boxes below add your app name, select a support email from the pull down menu, and add an app logo. Notice the small print below the App logo field.

28562856

Edit app registration information.



(v) Enter your App URL and its domain as indicated in the first and second green box, respectively.

28562856

Enter your App URL and domain

(vi) Enter the developer's email address. Click Save and continue.

28402840

Enter the developer's email address



(vii) Then Save and continue for each of scopes, test users, and summary. Return to dashboard by clicking "Back to dashboard" at the bottom of the summary window.

B. iOS Configuration

Skip to Android App Configuration

📘

Required Parameters

You should make note of the following parameters to activate Google Login within your GoNative App.

  • Client ID (found in Step B2)
  • URL scheme (found in Step B3)
  • iOS web client ID (found in Step B4)

Step B1. Configure your OAuth Client ID.

For the next step, we're going to leave the Google Cloud Platform and visit developers.google.com to create an OAuth client ID. Sign in to your account

(i) Click the blue button that says "Create an OAuth client ID"

28622862

Click "Create an OAuth client ID"

(ii) When prompted, select your project and click "Next".

28702870

Select your project and click "Next".

(iii) Select iOS and add your Bundle ID as shown in the green boxes, respectively. Then click "Create".

28702870

Select iOS and add your Bundle ID



Step B2. Record the client ID and download the configuration file.

❗️

Important Information

Record the iOS client ID by using the copy to clipboard button. Download the configuration file.

28442844

Record the client ID and download the configuration file.



Step B3. Create a URL Scheme.

❗️

Important Information

Generate a URL Scheme from the client ID manually. The URL Scheme will be the reversed client ID. Follow the example below to create your own:

Example:

If your iOS client ID is:

843254985318-c1q9b8809pul43h3q5u1q5t6ki0l10en.apps.googleusercontent.com

then your iOS URL Scheme is:

com.googleusercontent.apps.843254985318-c1q9b8809pul43h3q5u1q5t6ki0l10en



Step B4. Record the web client ID.

❗️

Important Information

Go to your API credentials. Find the “Web client (Auto-created for Google Sign-in)” in the name column from the OAuth 2.0 client IDs table. On the right click the copy to clipboard button as shown.

28802880

Copy and record the web client ID.



Step B5. Add javascript origins and redirect URIs

As shown in the green box below, click the "ADD URI" button and in the url field that appears, add the authorized javascript origins. Do the same for your redirect URIs then click save.

28482848

Adding javascript origins and redirect URIs

👍

iOS Google Login configuration complete!

Congratulations! You've completed configuring Google Login for iOS. Run the app and test google sign in.



C. Android Configuration


🚧

Already have a Google OAuth client ID?

If you already have an existing Google OAuth client ID, go to Log into your account and skip to Step C5.


🚧

For Firebase Console users

If you use Firebase Console, make sure to configure the Support Email in Firebase Console > Settings > General > Public Settings > Support Email


Step C1. Create an OAuth client ID.

Go to the Google Cloud platform console and complete the following steps.

(i) Create credentials by clicking on the "+CREATE CREDENTIALS" tab and then select "OAuth client ID" as shown in the green box in the image below.

28682868

Click +CREATE CREDENTIALS and then select OAuth client ID

(ii) Select Android from Application Type pull down menu as shown.

28622862

Select Android

(iii) Enter your package name and SHA-1 certificate fingerprint. If you are using GoNative to sign your Android app contact our team to obtain this value. If you are using Google Play App Signing it is available from the Google Play Console on the Release > Setup > App Integrity page.

28502850

Step C2. Set the authorized source and redirect URLs

(i) Go to the API credentials section in your Google Cloud platform console and complete the following steps.

(ii) You will may see several client IDs. Under OAuth 2.0 Client IDs, look for the “Web client (Auto-created for Google Sign-in)” from the OAuth 2.0 client IDs as shown below in the green box. Click the copy to clipboard button. This is your Android Client ID.

28382838

LocateWeb client (Auto-created for Google Sign-in)

(iii) Next, click the pencil edit icon just to the right and set the authorized source and redirect URLs by clicking "+ADD URI". Then click blue save button at the bottom of the screen.

28402840

Step C3. Testing Locally

If you are compiling your debug/release application from multiple machines you will need to create an OAuth client ID and provide the SHA-1 Certificate fingerprint of each local machine.

(i). Similar to Step C1. Go to the Google API Console, "+CREATE CREDENTIALS" tab and then select "OAuth client ID".

28682868

Click +CREATE CREDENTIALS and then select "OAuth client ID"

(ii) As before, select Android and then provide a Name, e.g. "John's Dev Machine"

For the Package Name, if you are building a debug variant in the Android Studio, by default the app build.gradle uses a .debug as an applicationIdSuffix so you will need to append .debug at the end of your package name. For example com.yourcompany.app.debug.

For the SHA-1 certificate fingerprint obtain the fingerprint from your local machine following the steps below.

❗️

Using a local SHA-1 certificate fingerprint

Use the following command to obtain the fingerprint of your local SHA-1 Keystore and enter in the field in the red box below.

keytool -keystore <path-to-debug-or-production-keystore> -list -v

Note that typically for debug, the keystore is usually stored at: `~/.android/debug.keystore`.

28502850

Provide a Name, the Package name, and SHA-1 Certificate fingerprint

(iii). Click Create and wait for the update to propagate. There is no need to change the client ID in the app itself.