Developing Google Sign-In Authentication
Google Sign-In is the most common OAuth provider for mobile apps. On Android it works especially smoothly via Credential Manager API (current approach with Android 14+), on iOS requires separate SDK and URL Scheme setup. Complexity — 1 out of 5, but several typical gotchas when first integrating.
Current SDK State
On Android, legacy GoogleSignIn SDK (com.google.android.gms:play-services-auth) replaced by Credential Manager with GetGoogleIdOption. Old API still works but Google recommends migration. New API shows Bottom Sheet with device's Google accounts — native UI without browser switch.
On iOS — GoogleSignIn-iOS SDK (pod GoogleSignIn, SPM google-signin-ios). Requires adding GIDClientID to Info.plist and URL Scheme setup for redirect after authorization.
Most common iOS integration mistake: forgot to add URL Scheme com.googleusercontent.apps.CLIENT_ID to Info.plist. Authorization opens browser but redirect back to app doesn't work.
Android Implementation
// Credential Manager (Android 14+ / Credential Manager API)
val googleIdOption = GetGoogleIdOption.Builder()
.setFilterByAuthorizedAccounts(false)
.setServerClientId(WEB_CLIENT_ID) // Not Android client ID, Web client ID
.build()
val request = GetCredentialRequest.Builder()
.addCredentialOption(googleIdOption)
.build()
val result = credentialManager.getCredential(context, request)
val credential = result.credential as? CustomCredential
// Handle GoogleIdTokenCredential
WEB_CLIENT_ID is client ID for web app in Google Cloud Console, not Android. This confusion is source of DEVELOPER_ERROR on first run.
ID Token Verification on Server
Client passes idToken to backend. Backend verifies via Google tokeninfo endpoint or locally via google-auth-library. ID Token contains sub (stable Google user ID), email, name, picture. sub is primary key for user identification, email can change.
Timeline: 4-7 working days. Includes Android Credential Manager + iOS GoogleSignIn SDK, server ID Token verification, handling case when Google Play Services unavailable (tablets without GMS).







