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
- In the Clerk Dashboard, navigate to the SSO connections page.
- Select Add connection and select For all users.
- In the Choose provider dropdown, select Google.
- Ensure that both Enable for sign-up and sign-in and Use custom credentials are toggled on.
- Save the Authorized Redirect URI somewhere secure. Keep this modal and page open.
Create the Google Developer Android client
- Navigate to the Google Cloud Console.
- Select an existing project or create a new one. You'll be redirected to your project's Dashboard page.
- In the top-left, select the menu icon (≡) and select APIs & Services. Then, select Credentials.
- 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.
- For the Application type, select Android.
- Complete the required fields.
-
Package name: Your package name is in your
build.gradle
file, formatted ascom.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
-
- Select Create.
Create the Google Developer Web client
- In the same project, create another client. Next to Credentials, select Create Credentials. Then, select OAuth client ID.
- For the Application type, select Web Application.
- Complete the required fields. In the Authorized Redirect URIs setting, paste the Authorized Redirect URI value you saved from the Clerk Dashboard.
- 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
- 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.
- Select Add connection.
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.
- In the Clerk Dashboard, navigate to the Account Portal page.
- 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
- For development -
- 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
Last updated on