使用Gmail API的Google云平台项目:为桌面应用程序创建令牌

发布于 2025-02-10 13:22:12 字数 1668 浏览 1 评论 0原文

范围:我想通过python和raspbery pi/raspian或Windows 10上的Gmail访问我的Gmail。

之后官方指南 Google我创建了一个项目,并启用了Gmail API,根据本指南对于桌面应用程序,下载并将其重命名为recertentials.json running quickStart.py我得到我获得的正如预期的:

>>> #获取Gmail API服务

...服务= gmail_authenticate()

请访问此URL以授权此应用程序:https://accounts.google.com/o/oauth22 /auth?Response_type=code&Client_id= [xxx.apps.googleusercontent.com& rediRect_uri = http%3A%3A%2F%2FlocalHost%3a34551; state = [xxx]& access_type = offline

在浏览器中打开URL时:

我关注链接到 unsafe

“在此处输入映像说明”

并获取localhost的链接:

http:// localhost:34551/?state state state state state state state state = [xxx]& code = [xxx]& scope = https://mail.google.com/

问题: 如何获得应用程序授权 /获取client_secret.json < / code>等?

Scope: I want to access my Gmail via python and the Gmail API on Raspbery pi /Raspian or Windows 10.

Following the official guide from Google I created a project and enabled the Gmail API, Authorization credentials for a desktop application according to this guide for Desktop app, downloaded it and renamed it to credentials.json when running quickstart.py I get as expected:

>>> # get the Gmail API service

... service = gmail_authenticate()

Please visit this URL to authorize this application: https://accounts.google.com/o/oauth2/auth?response_type=code&client_id=[XXX.apps.googleusercontent.com]&redirect_uri=http%3A%2F%2Flocalhost%3A34551%2F&scope=https%3A%2F%2Fmail.google.com%2F&state=[xxx]&access_type=offline

When opening the URL in the browser:
enter image description here

I follow the link to unsafe:

enter image description here

and get the link to localhost:

http://localhost:34551/?state=[XXX]&code=[XXX]&scope=https://mail.google.com/
enter image description here

Question:
How can I get the app authorized / get the client_secret.json, etc?

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

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

发布评论

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

评论(1

分开我的手 2025-02-17 13:22:13

安装XAMPP解决了问题。
在这种情况下,Windows II不起作用

Installing xampp solved the issue.
The windows IIS did not work in this case

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