Google Cloud setup
In the Google Cloud console, create three OAuth client IDs in one project:
| Client | Used for |
|---|---|
| Web application | The ID token audience; your backend exchanges server auth codes with it. GIDServerClientID on iOS, default_web_client_id on Android. |
| Android | Package name plus the SHA-1 of every signing key: debug, upload, and the Play App Signing key. Not passed to the library. |
| iOS | Bundle identifier. GIDClientID on iOS. |
:::warning Register every signing key
Credential Manager reports a missing SHA-1 as a cancellation right after the user picks an account, or as DEVELOPER_ERROR. Add the debug key, the upload key and the Play App Signing key to the Android client.
:::
Keep the client IDs in .env
The client IDs live in each platform's native config, under the same keys Google's own SDKs read. Keep them out of git in a .env file at the project root, which the native builds read. Write KEY=value lines with no quotes and no spaces around =:
# Web application client: the ID token audience on both platforms.
GOOGLE_WEB_CLIENT_ID=123456789-web.apps.googleusercontent.com
# iOS client and its reversed form, the URL scheme Google returns to.
GOOGLE_IOS_CLIENT_ID=123456789-ios.apps.googleusercontent.com
GOOGLE_IOS_URL_SCHEME=com.googleusercontent.apps.123456789-ios
The values are compiled into the app, so rebuild it after changing .env.
Pass webClientId or iosClientId to configure only to override the native config, for example per environment.