Python Google-api Quickstart示例的记录不足

发布于 2025-01-31 22:29:39 字数 1307 浏览 3 评论 0原文

他们说这是一个Quickstart,但是

我试图与Ruby连接到Google API的任何方式都有整整一周的时间,并最终说我要看看Python是否更容易,事实证明这不是。

我已经在OAuth证书中添加了重定向的URI。我尝试使用Web应用程序类型,桌面应用程序以及电视或有限的输入设备。

他们都返回错误。

  1. 错误400:重定向URI不匹配
  2. 错误400:无效的请求
  3. 无法将您登录,您使用的浏览器不支持JavaScript,请尝试在启用JavaScript的浏览器中登录。

即使将其设置为JSON凭据,它也一直在尝试使用Localhost URI。...

是否有人可以帮助我获得与API工作的基本示例,我开始失去希望它是甚至是现实的,尝试建立在我的研究中像我的研究一样混乱的API。到处都是,您会看到开发人员在需要一个小时的事情上浪费了5天。

下面的编辑!!!

这真是令人困惑,我只需要尝试进行基本的API呼叫并消除这些不屑一顾的依赖性带来的所有混乱。

我已经开始尝试使用Post Man和此教程>> httpps://medium.com/medium.com/kinand.com/kinandcartecte--google-google-google-authententication-postman--postman--postman--postman- 12943B63E76A

我已经成功地仅使用oauth2.0凭据来生成一个auth

令牌=“ nofollow noreferrer”> “在此处输入图像说明”

但是,当尝试击中此端点... 获取

我知道最终我需要对此应用程序进行适当配置的服务帐户,但是鉴于狂野的鹅追逐我已经推迟了它以保持实验的控制。

我将努力尝试在接下来的4个小时内揭开该服务帐户授权的神秘面纱...

They say its a quickstart but idk lol

Any way I have attempted to connect to the google api with Ruby for an entire week and eventually said I am going to see if its easier with python, turns out it is not.

I have added my redirect URI in the Oauth Credential. I have tried using a web applications type, a desktop app, and a tv or limited input device.

All of them return errors.

  1. Error 400: redirect uri mismatch
  2. Error 400: Invalid Request
  3. Couldnt Log you in, The browser you are using doesnt support javascript, please try signing in in a browser with javascript enabled.

It keeps trying to use a localhost uri even when its set to my authorized one in the json credentials....

Is there anyone who can help me just get a basic example connection to the API working I am starting to lose hope that it is even realistic to try and build on an API as chaotic as this has been in my research so far. Everywhere you go you see devs wasting 5 days on something that should take an hour.

Edits BELOW !!!!

This has been so confusing I had to just go to trying to make a basic api call and eliminate all of the chaos brought in by these deprecated dependencies.

I have moved to just trying to get data back using post man and this tutorial >> https://medium.com/kinandcartacreated/google-authentication-with-postman-12943b63e76a

I have successfully been able to generate an Auth token using ONLY an OAuth2.0 Credential that is of TYPE 'Web Application'

enter image description here

However when trying to hit this endpoint....
GET https://admin.googleapis.com/admin/directory/v1/customer/MY-CUSTOMER-ID/devices/mobile?projection=FULL

I get the following error...
enter image description here

I know that in the end I will need to have a service account for this application configured properly, however given the wild goose chase that this has been I have been putting it off to keep the experiment controlled.

I will be working hard on trying to demystify this service account authorization for the next 4 hours atleast...

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

夏尔 2025-02-07 22:29:39

我很难获得“ Quickstart”。

实际上,应该考虑到一些事情,实际上并未清楚地记录下来。

如文档中所示,在Google控制台的各个页面中设置了凭据后,您应该下载JSON文件并将其保存到与脚本相同的目录中。

请注意,QuickStart有其运行时启动的本地服务器。您可以在脚本中的此行中设置端口。例如:
creds = flow.run_local_server(port = 3000)

然后,当您在项目中配置凭据时,您将将重定向的URI设置为http:// localhost:3000/

它确实需要耐心,因为指出,有时需要几个小时才能生效,直到控制台中的凭证设置生效!

I had some difficulty getting the "quickstart" going as well.

There are a few things that should be taken into account that, in fact, aren't clearly documented.

After setting up the credentials in the respective page in Google Console as indicated in the documentation, you should download the json file and save it to the same directory as the script.

Take note that the quickstart has its own local server that it starts up when you run it. You can set the port in this line in the script. For example:
creds = flow.run_local_server(port=3000)

Then when you configure your credentials in the project, you would set the redirect URI to http://localhost:3000/

It does require some patience, because as noted, it does sometimes take several hours until the credentials settings in the Console take effect!

向地狱狂奔 2025-02-07 22:29:39

https://develovelers.google.com/sheets/sheets/papi/quickstart/quickstart/pytyth/python/python/ppython/a >

与CPTCOOK相同,在我的情况下,QuickStart中定义的端口设置为“ 0”,这会导致redirect_uri错误。

删除和使用默认情况解决了问题。

https://developers.google.com/sheets/api/quickstart/python

Same as CptCook, in my case the port defined in the quickstart is set to '0', which causes the redirect_uri error.

Removing and using the default resolved the issue.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文