简体   繁体   English

Javascript; 使用Gmail API的无需服务器的未读电子邮件检索

[英]Javascript; Server-less retrieving of unread emails with Gmail API

Thanks to OAuth2 many APIs are accessible from client side without any server. 借助OAuth2,无需任何服务器即可从客户端访问许多API。

I'm trying to do that with the unread emails in Gmail. 我正在尝试使用Gmail中未读的电子邮件来实现。

With the OAuth2 playground it is possible to achieve that. 使用OAuth2游乐场可以实现这一目标。 However my attempts are not successful (see reply). 但是,我的尝试没有成功(请参阅回复)。 I wonder if my attempts have been exhaustive and there is no way to achieve my goal or if I looked over a possibility? 我想知道我的尝试是否详尽无遗,没有办法实现我的目标,或者我是否考虑了可能性?

According to the official Gmail API doc there are two ways to access emails: 根据官方的Gmail API文档 ,有两种访问电子邮件的方法:

Browsers doesn't provide access to TCP to JavaScript and therefore IMAP/SMTP will not help here. 浏览器不提供对TCP到JavaScript的访问,因此IMAP / SMTP在这里无济于事。

After trying, the server behind https://mail.google.com/mail/feed/atom doesn't seem to support CORS. 尝试后,位于https://mail.google.com/mail/feed/atom后面的服务器似乎不支持CORS。 So no luck here neither. 所以这里也没有运气。

Apparently, a server is needed (or something like packaged apps that gives TCP access ) 显然,需要一台服务器(或提供TCP访问权限的打包应用程序之类的东西)

The new Gmail API lets you exactly do that; 新的Gmail API可让您完全做到这一点;

https://developers.google.com/gmail/api/ https://developers.google.com/gmail/api/

It uses OAuth 2 and a JavaScript wrapper library 它使用OAuth 2和JavaScript包装器库

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM