I faced the same issue and found the solution.
The Google Sign in works fine on emulators or on connected test devices but not on actual devices that downloads the your firebase app from google play store. This is because the apk file generated by your android studio is signed by default debug certificate fingerprint where as the application you publish on google play store is signed by different certificate finger print.
Both the certificate finger print should be whitelisted in firebase console otherwise the google sign in will not authenticate the user.
So to resolve this issue follow two steps.
Generate the release certificate fingerprint with following command on MAC
MAC:
keytool -exportcert -list -v \
-alias your-key-name
-keystore path-to-production-keystore
you will get output like following :
keytool -exportcert -list -v \
-alias aliasName -keystore /pathToKeystore/keyStore.jks
Enter keystore password:
Creation date: 27 May, 2017
Entry type: PrivateKeyEntry
Certificate chain length: 1
Certificate fingerprints:
MD5: 11:D0:F1:F6:26:F3:44:77:88
SHA1: D6:44:55:66:77:88:99:55:HH:AC:DB:17:8A
Where SHA1: is your fingerprint key, copy it.
For more info on how to generate fingerprint on MAC/WINDOWS visit https://developers.google.com/android/guides/client-auth
- Paste above SHA1 key to your firebase "Project Settings" and save. Google sign in should work fine now.
To read more on how this works visit https://developer.android.com/studio/publish/app-signing.html