3

I created an Android project on Google dev console using debug SHA1 fingerprint and also generated google-services.json file using same debug SHA1 fingerprint for by Google oauth2 implementation. Everything works fine. To upload the app to Google Play, I created one more project on Google dev console with release keystore SHA1 fingerprint and did not generate google-service.json. However, app is working fine even in release mode and I am able to do Google login in my app.

So what exactly is the use of google-services.json file? Should I create a new google-service.json file for release mode and how is it working even without it? That file has client_id of Android project that I created with debug SHA1 fingerprint.

I have checked both these links - link1 and link2 but did not find any answers satisfying. Thanks.

Community
  • 1
  • 1
androidGuy
  • 5,553
  • 12
  • 39
  • 56

1 Answers1

3

You do not need another json file for the same project. Google has simplified some manual steps by giving json file. You Google Cloud Project ID is the only thing required at the client side. Google Play Services will check with their server at the time of auth. and if there's a clientId created on the said Cloud project with SHA1 of the app requesting the auth, then it will work.

sandeepd
  • 515
  • 2
  • 16
  • but the GoogleSignInOptions.builder requestIdToken() needs a client_id parameter, how do I get it from the services json without copy pasting? – Frank Mar 04 '16 at 13:38
  • 1
    Yes, I did that. I mean at runtime. Can I get it from the json, or do I need to copy it into my own resources. I suppose it's the last (so it is saved at two locations: json and resources, which I don't like) – Frank Mar 07 '16 at 11:14