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

Some (but not all) 401 Unauthorized errors #890

Open
JoeGermuska opened this issue Mar 10, 2025 · 1 comment
Open

Some (but not all) 401 Unauthorized errors #890

JoeGermuska opened this issue Mar 10, 2025 · 1 comment

Comments

@JoeGermuska
Copy link
Member

JoeGermuska commented Mar 10, 2025

In the last week or so, we've had a number of reports of people trying to load a timeline and seeing the message

Error [401 Unauthorized] fetching sheets data

even though they have correctly followed the "publish to the web" steps.

Sometimes this even happens to timelines which have been published for some time, where the Google Sheets document has not been changed. Sometimes it happens for newly created timelines. However, many people are creating timelines without getting this error.

Note that this same message appears when "publish to the web" has not been done correctly, and sometimes when the Google Sheets document was created in a private Google Workspace where local administrators have limited the scope of "publish to the web". That is, the information in this issue doesn't apply in all cases when that error message appears.

A test to find if the error is the new circumstance is to edit the Google Sheets URL, which typically ends in /edit?gid=0#gid=0. Delete/edit and anything after it, and add /pubhtml.

If you edit your "problem" sheets URL as described and load it, you may see the message We're sorry, but the URL appears to be invalid. Please verify the URL format matches what is provided from the Google Docs editor or API.

If you see that message, one workaround is to copy your data into a new Google Sheets document, publish that one to the web, and, if this is a previously published timeline, update any embeds or links. Many people have told us that this has solved the issue for them.

If you do not get this message, then something else is happening. In that case, please file a support request

Note: the edited URL should look like https://docs.google.com/spreadsheets/u/1/d/1xuY4upIooEeszZ_lCmeNx24eSFWe0rHe9ZdqH2xqVNk/pubhtml although at this time, this URL does not demonstrate the problem.

@JoeGermuska
Copy link
Member Author

Here is another workaround, which does not require making a new spreadsheet.

We are proceeding on the theory that the message ** Please verify the URL format matches what is provided from the Google Docs editor or API** means that Google wants us to be using the version of the URL which appears in "publish to the web"

The warning not to use that URL dates back to TimelineJS's original method for getting data from Google Sheets. Changes to Google's APIs in 2020 led us to change how TimelineJS gets data, but since many thousands of timelines had been created the other way, we didn't change our authoring instructions.

It turns out that the new "publish to the web" URLs can work with the "new" (2020) change to how TimelineJS reads Google Sheets data, but the authoring tool currently prevents you from entering URLs in the "new" format.

Until we are able to update the authoring tool and instructions to allow the "new format" URLs, you can change it yourself, outside of the tool.

First, go to Google Sheets and return to the "share -> Publish to the web" interface, and copy the link from the area marked with an orange box in this screenshot:

Image

The link will have .../spreadsheets/d/e/ in it, like this: https://docs.google.com/spreadsheets/d/e/2PACX-1vQI-XgDRVhy1z0CSrHAvYk_Nz_6agyJQQvCCdS_hN-Vco0mUG6zYRqu-ToLAfgVMlCRRxH3YthpDSTX/pubhtml

Edit the URL to your timeline, which, if you use our embeds, will be in the src attribute of an iframe tag

The URL will look something like this:
...timeline3/latest/embed/index.html?source=1xuY4upIooEeszZ_lCmeNx24eSFWe0rHe9ZdqH2xqVNk&font=Default...

You can replace the value of the source parameter (here, 1xuY4upIooEeszZ_lCmeNx24eSFWe0rHe9ZdqH2xqVNk) with the full URL that you just got from publish to the web. So it would look something like this:

...timeline3/latest/embed/index.html?source=https://docs.google.com/spreadsheets/d/e/2PACX-1vQI-XgDRVhy1z0CSrHAvYk_Nz_6agyJQQvCCdS_hN-Vco0mUG6zYRqu-ToLAfgVMlCRRxH3YthpDSTX/pubhtml&font=Default...

This has worked in our testing, and we will be advising people who file support requests to try it. If you can vouch that it solves your problem and want to comment here, that will be helpful. We will explore the best way to change the editor and instructions and hopefully deploy a change soon, but since this seems to affect even some long-published timelines, this issue will hopefully help people.

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

1 participant