pkpio / fitbit-googlefit

Export Fitbit data to Google Fit. Unlike the alternatives such as fitnessyncer.com, this offers very fine intraday granularity (every minute/second data).
http://pkp.io/blog/fitbit-to-googlefit-sync/
GNU General Public License v3.0
500 stars 59 forks source link

Google Fit Sync Error 403 -- "Application Package Name Provided By un-Trusted Source" #62

Closed herfytoken closed 5 years ago

herfytoken commented 6 years ago

Hi -

This application has been fantastic for me. Thank you!

I've been able to use it to log Fitbit steps into Google Fit, and thus get a discount on my health insurance, which syncs with Google Fit, but not Fitbit. This is great!

I tried running the application today, and got this 403 error.

WARNING:googleapiclient.http:Encountered 403 Forbidden with reason "forbidden"
Traceback (most recent call last):
  File "app.py", line 110, in <module>
    main()
  File "app.py", line 75, in main
    remote.SyncFitbitToGoogleFit('steps',date_stamp)
  File "C:\fitbit-google\fitbit-googlefit-master\remote.py", line 145, in SyncFitbitToGoogleFit
    return self.SyncFitbitIntradayToGoogleFit(dataType, date_stamp)
  File "C:\fitbit-google\fitbit-googlefit-master\remote.py", line 188, in SyncFitbitIntradayToGoogleFit
    self.WriteToGoogleFit(dataSourceId, googlePoints)
  File "C:\fitbit-google\fitbit-googlefit-master\remote.py", line 91, in WriteToGoogleFit
    point=data_points)
  File "C:\Python36\lib\site-packages\oauth2client\util.py", line 137, in positional_wrapper
    return wrapped(*args, **kwargs)
  File "C:\Python36\lib\site-packages\googleapiclient\http.py", line 840, in execute
    raise HttpError(resp, content, uri=self.uri)
googleapiclient.errors.HttpError: <HttpError 403 when requesting https://www.googleapis.com/fitness/v1/users/me/dataSources/raw%3Acom.google.step_count.delta%3Afitbit%3Acharge-hr%3Aio.pkp.fbit-gfit/datasets/1536984000000000000-1537070340000000110?alt=json returned "Application package name () provided by un-trusted source.">

I've tried trouble-shooting this several ways, without success.

First, I deleted the google.json file in the auth folder, and re-ran the auth_google.py script. I was able to get the client ID & secret from the Google API console, which suggests the application was still recognized on their end. After re-creating the google.json file, I re-ran the app.py script, and the same error occurred.

Then I tried creating a new application on the Google side, following the instructions as before. I started by deleting google.json, then created the new application on Google's side, and then ran auth_google.py with the new application's client ID & secret. I re-ran app.py, and again got the same error.

How do I move forward from here?

juanmav commented 6 years ago

I have the same problem. Any idea what could be?

danmiller84 commented 6 years ago

I also have this problem

kabili207 commented 5 years ago

Google updated the Fit API to prevent REST applications from sending a packageName (which only Android applications can do). Pull request #63 will fix this.

pkpio commented 5 years ago

Should be resolved by #63