有没有一种方法可以使用Google Photos API,而无需通过用户提示进行身份验证? [英] Is there a way to use Google Photos API without requiring authentication through user prompt?

查看:92
本文介绍了有没有一种方法可以使用Google Photos API,而无需通过用户提示进行身份验证?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我以前在youtube和youtube analytics api上有一些经验,可以选择使用 https://developers.google.com/oauthplayground/实质上是为您自己的用户帐户api访问创建离线状态.通过在开发者控制台中创建密钥,可以将其添加到自定义oAuth凭据中.然后,您登录的用户帐户将生成访问令牌和刷新所需的令牌.我没有在此处看到Google Photos API作为选项列出.我宁愿不要创建一个网站只是为了一次提示(我自己).

I have some previous experience with the youtube and youtube analytics api where there was an option to use https://developers.google.com/oauthplayground/ to essentially create an offline situation for your own user account api access. By creating the key in the developer console you could add that to a custom oAuth credentials. The user account you were logged into would then generate the access token and refresh token needed. I do not see Google Photos API listed as an option here. I would prefer not to create a website just to get a prompt once (myself).

任何帮助将不胜感激.

Any help would be greatly appreciated.

推荐答案

如果您专门在令牌后向API提出自己的请求,则仍然可以使用OAuth 2.0游乐场.您可以在工具的步骤1 下,在左侧范围列表的下方,输入自己的范围. (该文本框标记为输入您自己的范围".)

If you are specifically after a token to make your own requests to the API, you can still use the OAuth 2.0 playground. You can enter your own scope in the tool under step 1, just below the list of scopes on the left side. (The text box is labelled "Input your own scopes".)

您可以在此处手动输入"身份验证和授权中列出的范围范围"页面.

Here you can manually enter a scope that's listed on the "Authentication and authorization scopes" page in the Google Photos Library API developer documentation.

步骤2 中,您可以访问刷新和访问令牌,并在步骤3 中构建自己的请求.请注意,您将无法列出此API的可能操作.

In step 2, you can access a refresh and access tokens and construct your own request in step 3. Note that you won't be able to List possible operations for this API.

请注意,您还可以从自己的Google开发人员项目中指定自己的OAuth客户端ID和客户端密钥.您可以在右侧的"<设置>使用您自己的OAuth凭据"下的设置"图标下找到此设置.否则,令牌会在一定时间后被游乐场自动吊销.

Note that you can also specify your own OAuth client ID and client secret from your own Google developers project. You can find this under the "settings" icon on the right, under "Use your own OAuth credentials". Otherwise, tokens are automatically revoked by the playground after a certain amount of time.

但是-如果您只想在操场上浏览API,则可以使用参考文档中嵌入的版本.您可以在每个页面上找到方法,例如 mediaItems .list .此版本包括对所有API方法的支持,并使得构建正确的API请求变得容易.

However - If you just want to explore the API through the playground, you can use the version that's embedded in the reference documentation. You can find it on each page for a method, for example mediaItems.list. This version includes support for all API methods and makes it easy to construct correct API requests.

这篇关于有没有一种方法可以使用Google Photos API,而无需通过用户提示进行身份验证?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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