Skip to main content
Docs

Sign in with Google

This guide will teach you how to add native Sign in with Google to your Clerk apps on Android platforms.

To make the setup process easier, it's recommended to keep two browser tabs open - one for the Clerk Dashboard and one for your Google Cloud Console.

Enable Google as a social connection

  1. In the Clerk Dashboard, navigate to the SSO connections page.
  2. Select Add connection and select For all users.
  3. In the Choose provider dropdown, select Google.
  4. Ensure that both Enable for sign-up and sign-in and Use custom credentials are toggled on.
  5. Save the Authorized Redirect URI somewhere secure. Keep this modal and page open.

Create the Google Developer Android client

  1. Navigate to the Google Cloud Console.
  2. Select an existing project or create a new one. You'll be redirected to your project's Dashboard page.
  3. In the top-left, select the menu icon () and select APIs & Services. Then, select Credentials.
  4. Next to Credentials, select Create Credentials. Then, select OAuth client ID. You might need to configure your OAuth consent screen. Otherwise, you'll be redirected to the Create OAuth client ID page.
  5. For the Application type, select Android.
  6. Complete the required fields.
    • Package name: Your package name is in your build.gradle file, formatted as com.example.myclerkapp.

    • SHA-1 certificate fingerprint: To get your SHA-1, run the following command in your terminal:

      terminal
      $ keytool -keystore path-to-debug-or-production-keystore -list -v

      Note

      Replace path-to-debug-or-production-keystore with the path to your debug or production keystore. By default, the debug keystore is located in ~/.android/debug.keystore. It may ask for a keystore password, which is android. Please note that Java is required to run the keytool command.

  7. Select Create.

Create the Google Developer Web client

  1. In the same project, create another client. Next to Credentials, select Create Credentials. Then, select OAuth client ID.
  2. For the Application type, select Web Application.
  3. Complete the required fields. In the Authorized Redirect URIs setting, paste the Authorized Redirect URI value you saved from the Clerk Dashboard.
  4. Select Create. A modal will open with your Client ID and Client Secret. Save these values somewhere secure.

Set the Client ID and Client Secret in the Clerk Dashboard

  1. Navigate back to the Clerk Dashboard where the modal should still be open. Paste the Client ID and Client Secret values that you saved into the respective fields.
  2. Select Add connection.

Note

If the modal or page is no longer open, navigate to the SSO connections page in the Clerk Dashboard. Select the connection. Under Use custom credentials, paste the values into their respective fields.

Test your connection

The simplest way to test your connection is to visit your Clerk app's Account Portal, which is available for all Clerk apps out-of-the-box.

  1. In the Clerk Dashboard, navigate to the Account Portal page.
  2. Next to Sign-in, select the button to visit the sign-in page. The URL should resemble:
    • For development - https://your-domain.accounts.dev/sign-in
    • For production - https://accounts.your-domain.com/sign-in
  3. Sign in with your connection's credentials.

Usage

To learn how to build a sign-up and sign-in flow that supports OAuth connections in your Android application, see the custom flow guide.

Feedback

What did you think of this content?

Last updated on