Cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Google apps script for minute-by-minute data stopped working suddenly

I have been using a Google Apps script in a Google Spreadsheet to download minute by minute data. Today I tried to download data for my account and I got "We're sorry, a server error occurred. Please wait a bit and try again" at the top of the spreadsheet. Did something change in the API that might be causing this? It might be something with Google, have no idea how to debug it.


 I have another spreadsheet that doesn't do the intraday stuff that's working fine.

 

This script was based off of things I found online

Here it is https://jsfiddle.net/j72qbe08/

Best Answer
87 REPLIES 87

This sounds like an issue with Google Spreadsheet, not the Web API itself. Fitbit has had periodic, brief spikes in errors. If you've waited a bit and tried again, it may be an issue with your Google Spreadsheet script.

Best Answer
0 Votes

When is Fitbit switching over to OAuth2.0? From what I've found online it looks like Google's phasing out of 1.0 is the issue.

Best Answer
0 Votes

Help!!! I've become so dependent on my daily fitbit data downloaded to my google spreadsheet that when I kept reaching errors today, I'm at a loss as to what to do to fix it. I am so not a techy but a very focused senior trying to keep track of my activities.

 

Every morning I open the fitbit data spreadsheet, choose 'script editor' from the 'Tools' menu. When the 'fitbit.gs' window appears, I choose, 'sync' from the 'Run' menu and then was always good to go. Today I was met with this warning:

Script is using OAuthConfig which has been shut down. Learn more at http://goo.gl/IwCSaV (line 29, file "")
 
I have spent hours, and I mean hours, trying to find out what to do but sadly to no avail. It would be greatly appreciated if you could either help me fix the problem or point me in the right direction. I'm so upset about this. Yes, I know I can get the same data from my settings but I much prefer the spreadsheet.
Best Answer
0 Votes

Based on the link you posted, it appears Google made some changes so that on July 6th, the script you were using with Google Spreadsheet no longer works. They offer 2 new scripts on that page for OAuth 1 and OAuth 2 which you could try to use with Fitbit. Sorry we don't have any more information on this as its something on Google's end. If you do find a solution, please do post a link or a guide as I'm sure there are others who are having the same issue.

Best Answer
0 Votes

Honestly, I've hours today trying to find a solution. I've wasted my entire day on this. Google was no help at all. I'm so frustrated that I don't know how to fix it.

Best Answer
0 Votes

You need to switch over to the Oauth1 or Oauth2 libraries. Should work with the Oauth1 library, just need to add that library to your script and tweak the script a bit to match the changes.

 

https://developers.google.com/apps-script/migration/oauth-config

 

Probably better to use OAuth2 though; I am planning release an updated version of the script soon.

Best Answer
0 Votes

I have been trying for the last 45 minutes to figure out what to do. I was okay with the initial set up but the next section, 'Redirect URI' absolutely stymied me. I haven't a clue what to do in this section. I looked through the list of all the data in script editor and I'm totally stuck. I really REALLY want this to work for me as I fear I will abandon the fitbit. For the last two days I have been doing the data export via setting and I must say it's not for me do to every day. I much prefer the google extract.

 

Please PLEASE help! You'd make one senior lady very VERY happy!

Best Answer
0 Votes

Thank you for all the instructions. They are so thorough and so easy to follow which I was easily able to do to a ‘T’ however have been met with the same warning each time, Script is using OAuthConfig which has been shut down. Learn more at http://goo.gl/IwCSaVD’ when I get to the 'Authorize' stage.

 

I’ve done everything correctly, even registering a new app on dev.fitbit.com. I’ve run into the same problem at the same point each time. I'm not a techie but because of your detailed instructions. I was able to follow them with the exception of #5.

 

Under #5, the instructions state to ‘Copy in the OAuth 2.0 Client ID, Secret, and project key…etc into the Set Up window. When I get this part, the only options I see are Fitbit OAuth Consumer Key, Fitbit OAuth Consumer Secret, Start Date for Download and Data Elements to download. There is no field for project key or OAuth 2.0 Client ID. As for the OAuth 2.0 Client ID. I tried using it as the Consumer Key and chose a start Date (chose 2015-01-01) and clicked on save. All was good until I chose ‘Authorize’ when I was met with the same red banner. I tried using the Client Consumer Key instead of the OAuth 2.0 Client ID but was met with the same results. This is as far as I can go. No sidebar, no link, nothing but the red warning at the top.

 

I have slowly gone through the entire process FOUR full times now in Firefox and once on Safari but am met with the red warning banner at the top stating ‘Script is using OAuthConfig which has been shut down. Learn more at http://goo.gl/IwCSaVD.

 

Please help me. I’ve been at this since I received this reply 3 hours ago. You've been so kind in sharing all your info and I am truly grateful.

Best Answer
0 Votes

If you are using a fresh spreadsheet, you shouldn't be getting that error. Sounds like you're just using your original file. You have to get rid of the old script and replace it with the new one in the interday.gs file. Guess step 1 may have been a bit confusing for someone who is new to Github. Sorry about that. Updated the readme, thanks.

 

 Best bet is to create a brand new Google Sheet and copy and paste in the contents of the file in the script editor.

Best Answer
0 Votes
Did do that....created new google spreadsheets and did cut and pastes of exactly what I was supposed to. Should I be deleting the old download data on dev.fitbit? I kept it but created a new app. Could this possibly be the problem?
Best Answer
0 Votes
Honestly, I do appreciate your help. The instructions were easy for me to follow...if I did everything slowly which I did. I read each task over and over to ensure that I did the correct thing.
Best Answer
0 Votes

What do you mean by "old download data on dev.fitbit"?

 

If you created a new spreadsheet, then there's no way you could get the errors you describe. There's no OAuthConfig in the new file, and the setup window in the script has been modified to include the project key. So based on your description, it must be using the old version of the script. When you open script editor in spreadsheet, make sure it matches the new script and doesn't have any of the old script in there. Perhaps you were accidentally opening the wrong spreadsheet.

 

Might take a bit of troubleshooting but I am happy to help; Don't worry about it.

Best Answer
0 Votes

First, many thanks for the support. Today is a new day and I'm determined to get it right!

 

By old download data on dev.fitbit I am referring to the first time that I registers an app and had been using this until July 7th.

 

This morning, I've already revoked it from Fitbit applications on my fitbit settings. I'm going to wipe everything clean and start from scratch, including deleting what I set up in dev.fitbit.com. Is this correct? I will even delete my google spreadsheet with all the data up to July 7th. Of course I will copy the data and paste into an Excel spreadsheet for future reference. It really does help me to keep looking back to see how far I've come. It keeps me motivated.

 

Again, thank you for any help you can offer!

Best Answer
0 Votes

You don't really need to do any of that.

Just make sure you're using the new script in a fresh spreadsheet. Have you verified that that still doesn't work?

Best Answer
0 Votes

Just did it again with the same results! I even deleted my original spreadsheet and revoked access from fitbit.

 

When I click on 'Set up' my only options are :

Fitbit OAuth Consumer Key:*
 
Fitbit OAuth Consumer Secret:*
 
* (obtain these at dev.fitbit.com)
  
Start Date for download (yyyy-mm-dd)
 
Data Elements to download:

 

As you can see, there are no fields for OAuth 2.0 Client ID or Project Key. What should I be entering into the first field? When I click on Save, it accepts what I have entered but when I click on 'Authorize', I get the same. red banner error  at the top.

 

I so want this to work but it's so frustration for me

Best Answer
0 Votes

I don't know what you're doing wrong, but there's no question that you're not using the right script. That's the old version you've got there. Go into the script editor from the spreadsheet you're trying to use and make sure it matches my script. e.g. the old version didn't have any mention of projectKey.

 

If you want I can take a look at your spreadsheet: click Share at the top right, then get shareable link, then change "anyone with the link can view" to "anyone with the link can edit".  You can revoke the access later. You can either post the link here, or there's a contact form on my website. Note, you might want to clear the Fitbit keys from it before you do so.

Best Answer
0 Votes

Aha! I was unsure at to from which line to copy and paste so I used the other one that closely resembled what I had used.

 

The first 6 lines of your script states:

/ VERSION 0.1, July 15 2015
// Simon Bromberg (http://sbromberg.com)
// You are free to use, modify, copy any of the code in this script for your own purposes, as long as it's not for evil
// If you do anything cool with it, let me know!
// Note: there are minor improvements/cleanups still to be made in this file, but it should work as is if everything is setup properly
// See readme on github repo for more information

 

Is all this to be included in the 'copy and paste'? Or from which line to the end do I copy? This may be my problem!!!  Just did it including EVERYTHING in your script. Got as far as Authorization and was met with this red banner error:

TypeError: Cannot call method "hasAccess" of undefined.DetailsDismiss
 
I'm going out now for a few hours. I will send you the ability to access my file. I really appreciate your help....BIG TIME!
 
..FRAN
Best Answer
0 Votes