Google Oauth 2.0 RESULT_CANCELED while using Google Fit api

One reason to get RESULT_CANCELED is if your package name is diferent than the one you define in your app.

Double check that you are not setting another applicationId in your build.gradle that could be different than package defined in your manifest.


I've encountered this problem just now. Took me a few hours to figure out, so i would like to point out for those who make the same mistake.

My Google API client cannot connect only on Production, everything works fine on Development environment.

This is because my app was set up to use "App Signing". With this, if you created the Oauth Client ID using the Production Keystore's SHA1 (or Upload Certificate's SHA1 in the picture), it will not be used, because google will remove this certificate and change to the "App Signing" certificate

App Signing

So what we need to do to fix the problem is: Simply create a new OAuth Client ID with this new SHA1 like so:

enter image description here

The issue is quite easy to encounter because most of the tutorials will tell you to find your Production SHA1 and use it in the API console. But except for if you use "App signing" then it won't work anymore.