我正在尝试通过表格 API 检索基于单元格的提要从谷歌电子表格中读取数据。该电子表格是私有的,所以我使用 oauth 2.0 来授权我的请求。
通过https://spreadsheets.google.com/feeds/spreadsheets检索有关我的驱动器帐户的基本信息工作正常,但是当我尝试通过 XMLHttp GET 请求直接访问我的电子表格中的数据到https://spreadsheets.google .com/feeds/cells
我收到“请求的资源上不存在‘Access-Control-Allow-Origin’标头”错误。
我已经设置了正确的授权令牌
xhr.setRequestHeader('Authorization', 'Bearer ' + token);
Run Code Online (Sandbox Code Playgroud)
并尝试通过“激活”CORS
xhr.setRequestHeader('Access-Control-Allow-Credentials', 'true');
Run Code Online (Sandbox Code Playgroud)
无济于事。
有关如何访问此资源的任何提示?
谢谢 !