Symptom
Native Google sign-in on iOS via @capgo/capacitor-social-login (backed by GoogleSignIn-iOS / GIDSignIn): the account chooser sheet appears, the user picks an account, then login fails with:
invalid_audience: The audience client and the client need to be in the same project.The user is dumped back on the login screen. Initialization succeeded; the failure is at token minting, after account selection.
Root cause
SocialLogin.initialize({ google: { webClientId, iOSClientId, iOSServerClientId } }) maps iOSServerClientId to GIDSignIn's serverClientID, which sets the ID token audience. Google enforces that the app client (iOSClientId) and the audience client (serverClientID) belong to the same Google Cloud project. If your debug build bakes the production iOS client (e.g. sourced from Info.plist GIDClientID) but targets a dev backend whose token validation — and therefore the web client id you pass — lives in a different Google Cloud project, every login fails this way.
Android is unaffected: Credential Manager takes only a serverClientId (the web client) and performs no same-project cross-check against an app-side client, so the identical dev/prod split works there. This asymmetry makes the iOS failure surprising.
Fixes
- Real fix for dev/debug builds: create an iOS OAuth client ID in the dev Google Cloud project (same bundle id) and bake that as
iOSClientIdfor debug builds. Note OAuth2 client creation is console-only; there is no public API. - Release builds are structurally immune when all client IDs come from the one production project.
- Don't confuse this with backend audience rejection: the backend never sees a token; GIDSignIn refuses to mint it client-side.