Google 保存到驱动器 API v3 停止工作

Google Save To Drive API v3 stopped working

希望有人能帮忙

我们使用 Google 的保存到驱动器按钮 API,版本 3 已经有一段时间了,可以将我们系统生成的文档保存到用户的驱动器中。这在上周停止工作了一段时间。

JS控制台抛出的错误是:

Uncaught ReferenceError: _createSaveToDriveWidgetApplication is not defined
at https://drive.google.com/savetodrivebutton?usegapi=1&src=(redacted URL)&filename=My%20Statement.pdf&sitename=My%20Company%20Name&origin=https%3A%2F%2F(redacted URL)&gsrc=3p&jsh=m%3B%2F_%2Fscs%2Fapps-static%2F_%2Fjs%2Fk%3Doz.gapi.en_GB.sedaY3Dv4HE.O%2Fam%3DwQE%2Fd%3D1%2Fct%3Dzgms%2Frs%3DAGLTcCO2t4glYwUJ-eH43TAA_offcn6l6Q%2Fm%3D__features__

所以我使用 google 的 API 文档中的演示源 found here 从头开始​​设置它。

我的测试源代码是这样的:

    <!DOCTYPE html>
      <html>
        <head>
          <title>Save to Drive Demo: Explicit Render</title>
          <link rel="canonical" href="https://(redacted)">
          
           <script src="https://apis.google.com/js/platform.js"></script>
          <script>
          
            window.___gcfg = {
              parsetags: 'explicit'
            };
          </script>
         
    
        </head>
        <body>
          <a href="javascript:void(0)" id="render-link">Render the Save to Drive button</a>
          <div id="savetodrive-div"></div>
          <script>
            function renderSaveToDrive() {
              gapi.savetodrive.render('savetodrive-div', {
                src: 'https://(redacted)/go.php',
                filename: 'My Statement.pdf',
                sitename: 'My Company Name'
              });
            }
            document.getElementById('render-link').addEventListener('click', renderSaveToDrive);
          </script>
        </body>
      </html>

编辑的文本是 URLS,两者完全相同的协议、主机、域和端口。此外,正在检索的内容开始提供以下响应 headers:

Access-Control-Allow-Origin: *
Access-Control-Allow-Headers: Range
Access-Control-Expose-Headers: Cache-Control, Content-Encoding, Content-Range

尽管我不需要 Origin header,因为此处未使用或不需要 CORS。

我已经在 MAC 和 Windows 上尝试了 Chrome、Safari、Firefox,结果总是一样 - 当调用 gapi.savetodrive.render 时,它因错误而停止:

Uncaught ReferenceError: _createSaveToDriveWidgetApplication is not defined

我真的不知道还能做什么,所以我在这里查询。我有 Googled 那个错误信息,但真的找不到任何关于它的东西。

这似乎是一个错误。

Save to Drive 按钮在添加到 HTML 文档时未显示。相反,控制台中显示以下错误:

Uncaught ReferenceError: _createSaveToDriveWidgetApplication is not defined

过去几天在问题跟踪器中至少报告了两次:

这些问题中的第一个已经引起了一些关注:目前有 3 人对其加注星标,并且已由 Google 内部报告(参见 comment #4):

Thank you for filing this report, I was able to reproduce the behaviour so have forwarded it internally.

对于受此影响的任何人,我建议给这个问题加注星标,以提高它的知名度。