> [!WARNING]
> **Warning:** Google Sign-In for Android is outdated and no longer supported. To ensure the continued security and usability of your app, [migrate
> to Credential Manager](https://developer.android.com/training/sign-in/credential-manager/) today. Credential Manager supports passkey, password, and federated identity authentication (such as Sign-in with Google), stronger security, and a more consistent user experience. For Wear developers: Credential Manager will be supported in Wear OS 5.1 and later on selected watches. Developers actively supporting Wear OS 3, 4 and 5.0 devices with Sign in with Google should continue using Google Sign-in for Android for your Wear applications. Sign in with Google support will be available on Credential Manager APIs for these versions of WearOS at a later date.

Use our Android sample app to see how Sign-In works, or
[add Sign-In to your existing app](https://developers.google.com/identity/sign-in/android/legacy-start-integrating).

**Required:** The latest versions of
[Android Studio](https://developer.android.com/sdk/) and
[Google Play Services](https://developer.android.com/sdk/installing/adding-packages.html).

## Get the project

If this is your first time using a Google services sample,
check out the google-services repository.

```
$ git clone https://github.com/googlesamples/google-services.git
```

Open Android Studio.

Select **File \> Open** , browse to where you cloned the
`google-services` repository, and open
`google-services/android/signin`.

## Configure a Google API Console project

To use the sample, you need to configure a Google API Console project with an Android client and a Web application client:

1. Open an existing project in the [API Console](https://console.cloud.google.com/), or create a project if you don't already have one.
2. On the OAuth consent screen page, make sure all of the information is complete and accurate.
3. On the Credentials page, create an **Android** type client ID. The package name for the sample app is `com.google.samples.quickstart.signin`. You will also need to provide the SHA-1 hash from your signing certificate fingerprint. See [Authenticating Your Client](https://developers.google.com/android/guides/client-auth.md.txt) for information.
4. On the Credentials page, create a **Web application** type client ID. You can leave the Authorized JavaScript Origins and Authorized redirect URIs fields blank. This web client ID is required by the sample's `IdTokenActivity` and `ServerAuthCodeActivity` examples. In a real app, this client ID would represent your app's backend server.
5.
   Copy and paste the client ID into your project's `strings.xml` file:

   ```
   <string name="server_client_id">YOUR_SERVER_CLIENT_ID</string>
   ```

## Run the sample

Now you're ready to build the sample and run it from Android Studio.

Build the sample and click the run button and select a connected
device or emulator with the latest version of Google Play services.
![](https://developers.google.com/static/identity/sign-in/android/images/gmpSignInAndroidRunSample.png)

## How it works

The application builds a `GoogleSignInClient`, specifying
the sign-in options it needs. Then, when the sign-in button is
clicked, the application starts the sign-in intent, which prompts the
user to sign in with a Google account.

```
// Configure sign-in to request the user's ID, email address, and basic
// profile. ID and basic profile are included in DEFAULT_SIGN_IN.
GoogleSignInOptions gso = new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN)
        .requestEmail()
        .build();
```

```
// Build a GoogleSignInClient with the options specified by gso.
mGoogleSignInClient = GoogleSignIn.getClient(this, gso);
```

```
private void signIn() {
    Intent signInIntent = mGoogleSignInClient.getSignInIntent();
    startActivityForResult(signInIntent, RC_SIGN_IN);
}
```

## Next steps

If you want to see how you can implement Google Sign-In in
your own app, take a look at our implementation guide.

[Add Sign-In to your app](https://developers.google.com/identity/sign-in/android/legacy-start-integrating)

Did you have a good experience? Run into trouble?
[Let us know!]()