简体   繁体   English

使用Java中的OAuth 2.0服务帐户的Google电子邮件设置API

[英]Google Email Settings api using OAuth 2.0 service account in java

I want to use Google Email Settings api using OAuth2.0 service account authentication method in Java, however I am unable to find any useful client classes from Google or sample examples about how to do this. 我想使用Java中的OAuth2.0服务帐户身份验证方法使用Google Email Settings API,但是我无法从Google找到任何有用的客户端类或有关如何执行此操作的示例示例。 I have had a look at Directory apis which are very useful for user or group related operations. 我看过目录api,它对于与用户或组相关的操作非常有用。 Is there any equivalent for Email Settings api? 电子邮件设置API是否有等效功能?

You can still use the old library AppsForYourDomainClient.jar with Service Accounts. 您仍然可以将旧库AppsForYourDomainClient.jar与服务帐户一起使用。 You need to override the method were the user/password are used and set your GoogleCredential: 您需要覆盖使用用户名/密码的方法,并设置您的GoogleCredential:

service = new GmailSettingsService(VERSION_HEADER, getDomain(), null, null) {
@Override
public void setUserCredentials(String username, String password)
        throws AuthenticationException {
    // Nothing to do here.
}};

service.setOAuth2Credentials(saCredential);

Google's own library is here: https://github.com/google/google-oauth-java-client , with Maven details if y are using it. Google自己的库在这里: https : //github.com/google/google-oauth-java-client ,如果您正在使用Maven详细信息。

Documentation, with examples, starts here: https://developers.google.com/api-client-library/java/google-oauth-java-client/ 文档和示例从此处开始: https : //developers.google.com/api-client-library/java/google-oauth-java-client/

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

相关问题 Google Apps电子邮件设置API和带有服务帐户的oauth2.0凭据 - Google Apps Email Settings API and oauth2.0 Credential with service account 通过OAuth 2.0服务帐户调用Google Contacts API会导致AuthenticationException - Calling Google Contacts API through OAuth 2.0 service account gives AuthenticationException 在Java中使用OAuth 2.0和Google Spreadsheet API的示例是什么? - What is an example of using OAuth 2.0 and Google Spreadsheet API with Java? Java中的Adwords API,OAuth2和服务帐户 - Adwords API, OAuth2 and service account in Java Java Google Api [服务帐户] - Java Google Api [Service account] Java Google Sheets API OAuth 2.0 - Java Google Sheets API OAuth 2.0 使用OAuth 2.0进行Java和Google Spreadsheets API授权 - Java and Google Spreadsheets API Authorization with OAuth 2.0 使用Java中的Google Plus API访问OAuth 2.0 - OAuth 2.0 access with Google Plus API in java Java -Spring Boot-OAuth 2.0配置以实现Google帐户登录 - Java -Spring Boot - OAuth 2.0 configuration to implement Google Account Login 使用Java和OAuth 2.0连接到Google联系人 - Using Java and OAuth 2.0 to Connect to Google Contacts
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM