为什么我会收到“经过身份验证的用户尚未安装带有客户端 ID 的应用程序"?原生使用 Google Drive API 时出错? [英] Why am I getting "The authenticated user has not installed the app with client id" error when using the Google Drive API natively?

查看:15
本文介绍了为什么我会收到“经过身份验证的用户尚未安装带有客户端 ID 的应用程序"?原生使用 Google Drive API 时出错?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在为 Emacs 开发 Google Drive 界面.这个概念是 Emacs 可以提供一种与平台无关的方式来加载、修改和保存存储在 Google Drive 中的文本文档.我已经注册了我的应用,并且可以使用 OAuth2 进行身份验证并使用 Docs List API 获取文件列表,但是当我尝试使用 Google Drive API 执行插入时,我看到了一个错误:

I'm working on a Google Drive interface for Emacs. The concept is that Emacs could provide a platform-agnostic way to load, modify and save text documents stored in Google Drive. I've registered my app and can authenticate with OAuth2 and get a file listing with the Docs List API, but when I try to execute an Insert with the Google Drive API, I see an error:

经过身份验证的用户尚未安装客户端 ID 的应用程序..."

"The authenticated user has not installed the app with client id ..."

进一步阅读,我似乎需要在 Chrome Web Store 中发布我的 Emacs 应用程序才能访问 Drive API.这对我来说没有意义......我注意到有一个 FUSE 项目正在为 Google Drive 开发,这表明本地开发是可能的.然而,当我浏览代码时,我没有看到 Chrome Web Store 组件可以让它工作.

Reading further, it seems I need to publish my Emacs application in the Chrome Web Store to get access to the Drive API. That doesn't make sense to me...I noticed that there is a FUSE project in development for Google Drive, which suggests that native development is possible. When I skimmed the code, however, I didn't see a Chrome Web Store component to getting it working.

我是在试图滥用 API,还是有办法让这项工作更有意义?

Am I trying to misuse the API, or is there an route to make this work that makes more sense?

推荐答案

根据 Google Drive 团队的 Ali Afshar 的说法,使用此 API 不再需要安装.因此,以下内容可能不再相关,但将留作历史用途.

According to Ali Afshar, of the Google Drive team, installation is no longer required to use this API. So what follows may no longer be relevant, but will be left for historical purposes.

所以,首先,从我们都在做的意义上说,API 不支持应用程序开发,但我不会使用原生这个词.好消息是我一直在做一些研究,而 Google Drive 实际上只是 Google Docs 的品牌重塑.因此,对于同样的目的,Google Docs API 也是一个不错的选择.

So, first off the API does not support application development in the sense that we are both doing it, I wouldn't use the word native though. The good news is I have been doing some research and Google Drive is really just a rebranding of Google Docs. So the Google Docs API could be a good choice as well for the same purposes.

无论如何,这是解决错误的步骤:经过身份验证的用户尚未安装具有客户端 ID 的应用程序......"这是一个 403 错误,为了这个答案.这些步骤假设您已根据需要在 chrome 网上商店中设置并安装了一个应用程序. 我也在本地机器上工作,我的项目是:http://github.com/tom-dignan/gdrive-cli 我已经克服了这个错误,所以我想你应该继续使用您的 emacs 版本,因为我认为我们可以完成这项工作.

Anyway, here's the steps to solve the error: "The authenticated user has not installed the app with client id ..." Which is a 403 error, for the sake of this answer. These steps assume you have set up an app in the chrome web store as is required, and installed it. I am working on my local machine too, with my project: http://github.com/tom-dignan/gdrive-cli which I have gotten past this error, so I think you should keep plugging away at your emacs version, because I think we can make this work.

一个.打开 Google API 控制台.

b.确认您已经在API 访问"下启用了 API,应该启用 API 和 SDK for Google drive.在那里,您可以获得您的客户端机密/api 密钥等.我几乎肯定你已经这样做了,所以继续 C.(这是为可能错过它的其他人准备的)

b. Confirm you've already enabled the apis under "API Access" both the API and SDK for Google drive should be enabled. There you get your client secrets/api keys and such. I am almost positive you've done this already, so go ahead to C. (this is here for others who may have missed it)

c.在左侧导航栏中的Drive SDK"下,您需要执行以下操作:

c. In the left navigation bar, under "Drive SDK" you will need to do the following:

  1. 添加支持 URL"(必需)

  1. Add a "Support URL" (required)

至少添加一个 16x16 的小应用程序图标(必需)

Add at least a small 16x16 application icon (required)

在 Drive Integration 下添加OAuth Client ID(必需)"(我只是在修修补补,这似乎是关键字段.)

Add "OAuth Client ID (Required)" under Drive Integration (I was just tinkering and this seems to be the key field.)

添加打开 URL(必需)URL,以便从 Google Drive UI 中为您的应用打开."

Add "Open URL (Required) URL to open for your app from the google drive UI."

勾选多文件支持"

添加一些 MIME 类型和文件扩展名,例如text/plain"和 txt

Add some MIME types and file extensions, "text/plain", and txt for example

添加授权范围:

https://www.googleapis.com/auth/userinfo.email

https://www.googleapis.com/auth/userinfo.profile

不要费心尝试在此处添加 Google 文档的身份验证范围,因为它不起作用.Google 不希望我们以这种方式使用它,因为驱动应用程序创建的文件应该是该应用程序私有的.与 Google Docs 的集成必须分开.

Don't bother trying to add the auth scopes for Google Docs here, because it won't work. Google does not want us to use it that way because files that drive apps create should be private to that app. Integration with Google Docs will have to be separate.

现在我知道您一定在想为什么我必须添加其中一些……"这是因为表单将它们设为必填字段.在我的网站中,我放置了几个指向静态 HTML 页面的 URL.

Now I know you must be thinking "why do I have to add some of these..." It's because the form makes them required fields. In mine, I put a couple URLs that point to static HTML pages.

完成上述操作后,清理您的状态并重新安装您的 chrome 应用.然后再次尝试您的代码,它应该停止给您 403.

Once you've done the above, clean up your state and reinstall your chrome app. Then try your code again, and it should stop giving you a 403.

这篇关于为什么我会收到“经过身份验证的用户尚未安装带有客户端 ID 的应用程序"?原生使用 Google Drive API 时出错?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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