简体   繁体   English

使用Google oAuth2从Java应用程序收集Gmail电子邮件

[英]Using google oAuth2 to collect gmail email from java app

I have a web base email client that uses a java app to connect to IMAP and POP3 servers to download email. 我有一个基于Web的电子邮件客户端,该客户端使用Java应用程序连接到IMAP和POP3服务器以下载电子邮件。 There is an issue that if a user usually logs in form the US that the java app will not have access to collect emails until that user logs in from the same county the java app is running. 存在一个问题,如果用户通常以美国身份登录,则该Java应用程序将无法访问收集电子邮件,除非该用户从该Java应用程序所在的县登录。

I was told to overcome this to use google oAuth in order for the account user to give permission to my app to collect emails. 我被告知要克服此问题,请使用google oAuth,以便帐户用户向我的应用授予收集电子邮件的权限。 Is this correct? 这个对吗? Once this has been accomplished I would also like to the the API to import contacts, but for now authorization/authentication is sufficient. 完成此操作后,我还希望API导入联系人,但就目前而言,授权/身份验证就足够了。

The problem I am facing is that after trying to make heads a or tails of the google oAuth api documentation im really confused and did not yet manage to make a working example. 我面临的问题是,在尝试使google oAuth api文档的正面或反面之后,im确实感到困惑,并且尚未设法做出可行的示例。 Documentation often has links to a depreciated API and there is no example with a dowload link to both the API needed and exaple source code, as a result I think im using incorrect libraries for my examples. 文档中经常有指向已贬值的API的链接,没有示例带有同时链接到所需API和示例性源代码的dowload链接,因此我认为我的示例使用了错误的库。

Its also not clear to me what/how to accomplish what is needed do I use client authentication via javascript to create a popup whereby the user grants access? 我也不清楚我需要什么/如何完成需要做的事情,我该如何通过javascript使用客户端身份验证来创建弹出窗口,以便用户授予访问权限?

Or do I use installed app client with a token and secret, this is what I tried but the 'command line' example I tried requires Java EE and this is a native app so I dont see why and I dont want to import all Java EE libraries to my small email downloader app. 还是我将已安装的应用程序客户端与令牌和密码一起使用,这是我尝试过的,但是我尝试过的“命令行”示例需要Java EE,并且这是本机应用程序,所以我看不到原因,也不想导入所有Java EE库到我的小型电子邮件下载器应用程序。

Where can I find more intuitive documentation and working examples on this? 在哪里可以找到更直观的文档和工作示例?

If you stay away from OpenID 2 and OAuth 1, I think the docs are pretty orderly these days. 如果您远离OpenID 2和OAuth 1,我认为这些天文档井井有条。 The best place to start is https://developers.google.com/accounts/docs/OAuth2 最好的起点是https://developers.google.com/accounts/docs/OAuth2

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

相关问题 如何使用 OAUTH2 配置 Java 应用程序以发送 Email 和 Gmail 服务? - How to configure Java Application to send Email with Gmail service using OAUTH2? Gmail 在 Java 中带有 Oauth2,带有带有 AuthorizationCodeFlow 的刷新令牌 - Gmail with Oauth2 in Java with refresh token with AuthorizationCodeFlow 如何使用 Google Account Credential OAuth2 (Java) 从 Google 注销 - How to logout from Google using Google Account Credential OAuth2 (Java) 使用 oauth2 和 Google / Azure 身份验证服务器在 java 应用程序中注销时出现问题 - Problem to logout in java app with oauth2 and Google / Azure auth server 如何使用Java / Android中的OAuth通过Gmail发送电子邮件? - How to send email through Gmail using OAuth in Java/Android? 使用OAuth2令牌对Google App Engine上托管的API进行身份验证? - Using OAuth2 token to authenticate to an API hosted on Google App Engine? Javamail gmail 和 OAuth2 - Javamail gmail and OAuth2 使用OAuth2的Google授权 - Google Authorisation using OAuth2 在Android中使用Gmail API和OAuth2检查来自Gmail的新电子邮件 - Check for new emails from Gmail with Gmail API and OAuth2 in Android 发送电子邮件OAUTH2 SMTP Outlook Java - Send email OAUTH2 SMTP Outlook Java
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM