To use AppAuth with Google Sign-In, you must create an OAuth2 client ID in the Google Developer Console and configure your Android project with the resulting credentials and redirect URI scheme.
1. Obtain your SHA-1 fingerprint
You need the SHA-1 fingerprint of the certificate used to sign your app. If you are using the provided appauth.keystore, you can extract the SHA-1 signature using keytool:
keytool -list -v -keystore appauth.keystore -storepass appauth | \
grep SHA1\: | \
awk '{print $2}'
2. Configure auth_config.json
Create or update your auth_config.json file with your Google client ID. The redirect_uri must follow the pattern com.googleusercontent.apps.PREFIX:/oauth2redirect, where PREFIX is the alphanumeric string from your client ID.
{
"client_id": "PREFIX.apps.googleusercontent.com",
"redirect_uri": "com.googleusercontent.apps.PREFIX:/oauth2redirect",
"authorization_scope": "openid email profile",
"discovery_uri": "https://accounts.google.com/.well-known/openid-configuration"
}
3. Update Android Manifest Redirect Scheme
In your module-level build.gradle file, replace the appAuthRedirectScheme placeholder with your specific Google client prefix (e.g., com.googleusercontent.apps.PREFIX).
4. Install the app
Build and install the app to test the integration:
./gradlew :app:installDebug