Google Oauth 2.0 RESULT_CANCELED while using Google Fit api

后端 未结 7 1972
死守一世寂寞
死守一世寂寞 2020-12-11 04:04

I am trying to use google fit api in my android app. I followed this guide and created SHA-1 certificate using keytool.exe in my jdk 1.8 bin folder. I have now created Oauth

7条回答
  •  借酒劲吻你
    2020-12-11 04:44

    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

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

    The issue is quite easy to encounter because most of any tutorial 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 any more.

提交回复
热议问题