Google Sign-in integration provides your users with a secure and familiar authentication experience. Launchtoday seamlessly incorporates Google’s authentication services through Supabase, offering a robust and reliable authentication system that’s easy to implement and maintain.

Setting Up Google Cloud Platform

The integration process begins with configuring your Google Cloud Platform (GCP) project. This setup involves creating the necessary OAuth credentials and configuring the consent screen that users will see when signing in to your application.

Start by visiting the Google Cloud Console and either create a new project or select an existing one. Navigate to the OAuth consent screen configuration where you’ll need to provide essential information about your application:

  • Application name
  • User support email
  • Developer contact information
  • Authorized domains (add your Supabase project URL without the protocol, e.g., <project-id>.supabase.co)

Creating OAuth Credentials

After configuring the consent screen, you’ll need to set up OAuth 2.0 credentials for both web and mobile platforms. Please follow the steps carefully.

Web Application Credentials

  1. In the Google Cloud Console, navigate to APIs & Services > Credentials
  2. Click “Create Credentials” and select “OAuth client ID”
  3. Choose “Web application” as the application type
  4. Configure the authorized redirect URIs using your Supabase callback URL

To locate your Supabase callback URL, navigate to your Supabase dashboard (Authentication > Providers > Google) and copy the value:

Then add it to the Authorized redirect URIs in your Google Cloud Console:

Upon completion, you’ll receive your Client ID and Client Secret:

With your Google OAuth credentials in hand (Client ID and Client Secret), configure your Supabase project to enable Google authentication:

  1. In Supabase, navigate to the Authentication > Providers > Google
  2. Enable the Google provider (click the toggle by Enable Sign in with Google)
  3. Enter the Client ID and Client Secret obtained from Google Cloud Console

Android Application Credentials

For Android applications, additional credentials are required to ensure secure authentication and prevent unauthorized access to your Google Sign-in implementation.

  1. Return to Google Cloud Console > APIs & Services > Credentials
  2. Create another OAuth client ID, selecting “Android” as the application type
  3. Enter your application’s package name (e.g., com.launchtoday.app)
  4. Add your SHA-1 certificate fingerprint (see below for details on how to create this)

Generating SHA-1 Certificate Fingerprint

The SHA-1 fingerprint acts as a unique identifier for your Android application, helping Google verify that requests are coming from your legitimate app. To obtain your SHA-1 fingerprint, execute the following command from your project’s root directory:

keytool -keystore android/app/debug.keystore -list -v

When prompted, enter the keystore password (default is android as specified in your app’s build.gradle file). The command will output your SHA-1 fingerprint:

Add this fingerprint to your Android OAuth client configuration in Google Cloud Console:

Testing the Integration

Once configured, you can test the Google Sign-in flow by running your application with either yarn android or yarn ios. The authentication process will present users with Google’s standard sign-in interface, where they can select their Google account and grant permissions to your application.

Remember to test both the success and failure scenarios to ensure your application handles all cases gracefully. The integration automatically manages token refresh and session persistence, providing a seamless authentication experience for both Android and iOS users.