App Store Requirement: If you implement Google Sign-In for iOS, Apple requires that you must also implement Apple Sign-In to pass the App Store review process. This is a mandatory requirement from Apple, not optional.
Prerequisites
Before setting up Google Sign-In, make sure you have:- Set up your Supabase project with basic configuration
Step 1: Set Up a Google Cloud Project
If you’ve already set up Push Notifications for Android, you likely have a Google Cloud project. You can use the same project for Google Sign-In.
Create a new Google Cloud Project
Create a new Google Cloud Project
- Create a Google Cloud project for your app in the Google Cloud Console, if you don’t have one already
- Give it the name of your app
- Select the organization you want to use
- Click Create
- Wait for the project to be created
1
Enable the Google Sign-In API
- Select your Google Cloud project
- Click on APIs & Services in the left menu
- Click ”+ ENABLE APIS AND SERVICES” at the top
- Search for “Google Identity” and select “Google Identity Services API”
- Click Enable
2
Configure the consent screen
- Pick the OAuth Consent Screen option in the left menu
- Click “Get started”
3
Complete the consent screen configuration
- App Information: Fill it out the form with App Name and User support email
- Audience: pick “External”
- Contact Information: These email addresses are for Google to notify you about any changes to your project
- Finish: Agree to the Google API Services: User Data Policy
- Press “Create”
Step 2: Create Web OAuth Client ID
You need to create a Web OAuth Client ID for Supabase authentication to work properly. This client is required regardless of which platform (iOS/Android) you’re targeting.1
Access the Google Cloud Console
In the Google Cloud console, navigate to Menu > Google Auth platform > Clients
2
Create OAuth Client
- Click the Create Client button
- For Application type, select Web application
- In the Name field, enter a descriptive name for your credential (e.g., “Supabase Web Client”)
3
Configure Authorized URIs
Set up the appropriate URIs for your application:
-
Under Authorized JavaScript origins, click Add URI
- Enter your Supabase project URL from
.env
(e.g.https://yourprojectref.supabase.co
)
- Enter your Supabase project URL from
-
Under Authorized redirect URIs, click Add URI
- Enter your Supabase project URL from
.env
+/auth/v1/callback
(e.g.https://yourprojectref.supabase.co/auth/v1/callback
)
- Enter your Supabase project URL from
4
Generate and Save Credentials
- Click Create to generate your OAuth client ID
- Your new credentials will appear after they are created:
- Save your Client ID and Client Secret - you’ll need these to configure Supabase
This web client is required for Supabase authentication integration. You’ll use these credentials in the Supabase dashboard to enable Google authentication.
Step 3: Configure Supabase Google Provider
1
Access Supabase Authentication Settings
- Go to your Supabase Dashboard
- Select your project
- Navigate to Authentication in the left sidebar
- Select Sign In / Providers tab
2
Configure Google Provider
- Find and click on the Google provider
- Toggle the switch to Enable the Google provider
- Client ID: Enter your Client ID (e.g.
your-web-client-id
) - Client Secret: Enter your Client Secret
- Callback URL (for OAuth): Verify that the Callback URL matches the Redirect URI you set up in the Google Cloud Console
(e.g.
https://yourprojectref.supabase.co/auth/v1/callback
) - Click Save to apply your changes
Step 4: Create Platform-Specific OAuth Clients
After setting up the web client for Supabase, you need to create platform-specific OAuth clients for each platform you want to support.1
Get SHA-1 Certificate Fingerprint from Expo Dashboard
- Go to the Expo Dashboard Project Credentials page
- Click on your Application Identifier (e.g., com.buildwithai.travelapp)
- Under the Android upload keystore section, find and copy the SHA-1 Fingerprint
- Save this value for the next step.
2
Create Android OAuth Client ID
- In the Google Cloud console, navigate to Menu > Google Auth platform > Clients
- Click the Create Client button
- Select Android as the application type
3
Configure Android Client Settings
- Enter a descriptive Name for your Android application
- Enter your app’s Package name in the Package name field
- This should match the package name in your
app.json
(e.g.,com.buildwithai.travelapp
)
- This should match the package name in your
- Enter the SHA-1 certificate fingerprint you copied earlier
- Click the Create button
- Save your Android Client ID - you’ll need it for your app configuration
Step 5: Enable Google Sign-In in Your App
Now that you’ve set up all the necessary OAuth clients, you need to configure your app to use Google Sign-In:1
Implementation
Follow the implementation instructions in the
integrations/google-auth/README.md
file included in your boilerplate codebase. This file contains all necessary steps for setting up Google Sign-In in your application, including:- File activation
- Package installation
- Environment variables configuration
- Platform-specific setup for iOS and Android
- Code enablement
Testing Your Configuration
- Rebuild development build and open it on your device
- Navigate to the sign-in screen
- Tap the “Sign in with Google” button
- Complete the Google authentication flow
- Verify that you are successfully signed in to your app