Overview:
Unity Authentication with Google Play Games can return error 10002 (“token verification failed”) when the Google Play server-side access code cannot be verified. A very common cause is reusing or delaying the use of the code (it is single‑use and short‑lived). Other frequent causes include configuration mismatches (wrong OAuth Web Client ID/secret), environment mismatches (signing into a different Unity environment than the one configured), or the Google Play Games Services API being disabled in the linked Google Cloud project. In this flow, the server auth code is obtained via RequestServerSideAccess and exchanged once in SignInWithGooglePlayGamesAsync.
Symptoms:
- Google Play Games sign‑in UI completes and returns a server auth code (serverAuthCode) from RequestServerSideAccess.
- The subsequent Unity Authentication call (SignInWithGooglePlayGamesAsync) fails with error 10002 (“token verification failed”).
- Retrying with the same server auth code fails repeatedly.
- Intermittent success if a fresh server auth code is used immediately, followed by failures when the same code is reused.
Cause:
- Single‑use and short‑lived server auth code: the code cannot be reused, and it expires quickly if not exchanged promptly.
- Configuration mismatches:
- Unity Dashboard (Authentication > Google provider) uses the wrong credentials (Android client ID instead of the OAuth Web Client ID/secret).
- Credentials do not belong to the Google Cloud project linked to the Play Console game.
- Environment mismatch:
- Attempting sign‑in against a Unity environment (prod/dev/staging) that does not have the Google provider credentials configured.
- Google Play Games Services API disabled in the Google Cloud project linked to the Play Console game.
Resolution:
- Use a brand‑new server auth code once and immediately after it’s issued by RequestServerSideAccess; do not reuse the same code for retries.
- Confirm the OAuth Web Client ID and secret in Unity Dashboard (Authentication > Google provider) match the Google Cloud OAuth Web Client linked to your Play Console game (not the Android client).
- Ensure the Google Play Games Services API is enabled in the Google Cloud project linked to your Play Console game.
- Verify you are authenticating against the same Unity Dashboard environment where those Google provider credentials are configured (prod vs staging).
- If applicable, confirm the tester account is properly whitelisted in Play Console.
- If issues persist, test on a different device/network to rule out transient conditions.
More Information:
- Unity Authentication (Google provider) setup guidance in the Unity Dashboard.
- Google Play Games Services documentation (OAuth Web Client credentials and API enablement).
- Keywords: RequestServerSideAccess, SignInWithGooglePlayGamesAsync, serverAuthCode, Google Play Games Services API, OAuth Web Client ID, Unity Authentication Google provider, error 10002, token verification failed, PGS sign‑in.