Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed Authorization #47

Closed
dominiquera opened this issue Apr 8, 2018 · 9 comments
Closed

Failed Authorization #47

dominiquera opened this issue Apr 8, 2018 · 9 comments

Comments

@dominiquera
Copy link

Hi,

I am getting following error:

RNGoogleFit: Authorization - Failed Authorization Mgr:ConnectionResult{statusCode=SIGN_IN_REQUIRED, resolution=PendingIntent{b70bd65: android.os.BinderProxy@ef1db09}, message=null}`

startResolutionForResult() is being called and I can click on my google account to sign in but onActivityResult() always receives RESULT_CANCELED.

I am still quite new in react native and would really appreciate some help :)
Thank you

@StasDoskalenko
Copy link
Owner

@dominiquera ensure you've followed all the instructions: https://developers.google.com/fit/android/get-api-key

@dominiquera
Copy link
Author

@StasDoskalenko thanks for following up.

I have created an OAuth client id with my SHA1 debug key (from .android dir but also copied this key in the android/keystore directory that in the react native folder) and put in the package name found in the manifest. Then put the client_secret.json file in android/app folder (do I need to name it differently?). I have also enabled "Fitness API" in the Api services. Do I need to make any additional configuration? Also I ran "react-native link react-native-google-fit" before actually adding the certificate if that could cause the issue...

Regards
Dom

@StasDoskalenko
Copy link
Owner

@dominiquera actually, you must carefully follow manual installation as well

@dominiquera
Copy link
Author

@StasDoskalenko Did that. Checked that everything has been set up correct

@StasDoskalenko
Copy link
Owner

@dominiquera
TEMP solution for you: try to download client_secret.json from google api console and save it to android/app
clear gradle cache and try to rebuild

@dominiquera
Copy link
Author

@StasDoskalenko same error persists unfortunately. I have also tried adding path, password and alias to local.properties file in android dir. Not sure how to debug the error to get a more helpful message

@StasDoskalenko
Copy link
Owner

@dominiquera Your error is definitely about you've missed something from Google FIT API authentication steps. Try to start from the scratch and follow Google Documentation carefully.

@dominiquera
Copy link
Author

I have finally found the issue. The setup was all correct but I was running react-native run-android with "sudo" because I didn't give full permission. That had several consequences for example the variables I added to the bash_profile were not read and I had to create a properties file pointing to the sdk. So I think by running with sudo something was not read correctly or loaded into the build path. Thanks for your help @StasDoskalenko

@StasDoskalenko
Copy link
Owner

@dominiquera you're welcome. Yeah in general almost all errors are caused by inattention :)
Anyway, feel free to ask me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants