为什么 google-slides rest API 会忽略我的 api-key? [英] Why does google-slides rest API ignore my api-key?

查看:26
本文介绍了为什么 google-slides rest API 会忽略我的 api-key?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用幻灯片休息 API 来检索演示文稿.我试图阅读我自己的简单演示以及示例中的演示.现在我只是想输入以下请求.https:///slides.googleapis.com/v1/presentations/1EAYk18WDjIG-zp_0vLm3CsfQh_i8eXc67Jo2O9C6Vuc?fields=slides.objectId&key=*********

I'm trying to use the slides rest APIs to retrieve a presentation. I've tried to read my own simple presentation as well as the one in the samples. Right now I'm just trying to enter the following request. https://slides.googleapis.com/v1/presentations/1EAYk18WDjIG-zp_0vLm3CsfQh_i8eXc67Jo2O9C6Vuc?fields=slides.objectId&key=*********

不管我是否传入我的 API 密钥,我始终遇到以下问题代码":401,消息":请求缺少所需的身份验证凭据.预期的 OAuth 2 访问令牌、登录 cookie 或其他有效的身份验证凭据.请参阅 https://developers.google.com/identity/登录/web/devconsole-project."

It doesn't matter if I pass my API key in or not, I consistently get the following issue "code": 401, "message": "Request is missing required authentication credential. Expected OAuth 2 access token, login cookie or other valid authentication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project.",

我对sheets API 进行了类似的调用,没有出现任何问题.

I've done similar calls with the sheets API with no issues.

非常感谢任何解释为什么我的密钥被忽略的帮助.谢谢!

Any help explaining why my key is being ignored is greatly appreciated. Thanks!

推荐答案

中有两种主要的方式来授权请求Slides API :使用 API 密钥oAuth 2.0.请注意,如果您使用 API 密钥,演示文稿必须公开为 在文档中解释.如果演示文稿未公开,则您将无法使用 API 密钥,而需要使用 oAuth 2.0 令牌.

There are two main ways to authorize requests in Slides API : using API Keys or oAuth 2.0. Note that if you use an API Key the presentation must be public as explained in the documentation. If the presentation is not made public then you will not be able to use the API Key and instead you will need to use an oAuth 2.0 token.

根据您的情况考虑是否要公开您的演示文稿(在这种情况下您可以使用 API 密钥)或不公开(在这种情况下您需要使用 oAuth 2.0).

Depending on your case scenario consider if you want to make your presentation public (in which case you can use API Keys) or not (in which case you will need to use oAuth 2.0).

这篇关于为什么 google-slides rest API 会忽略我的 api-key?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆