oauth 2.0 - How can we add oauth2( serviceaccount) with emailsettings? -
previously using https://apps-apis.google.com/a/feeds/emailsettings/2.0 following approach manage sendas , set.
gmailfilterservice = new gmailfilterservice(this.applicationname); gmailfilterservice.setoauthcredentials(oauthparameters, signer); gmailfilterservice.setreadtimeout(lxxx.readtimeout); gmailfilterservice.usessl();
how can use oauth2 service account
googlecredential credential = new googlecredential.builder() .settransport(httptransport) .setjsonfactory(jsonfactory) .setserviceaccountid(serviceaccountemail) .setserviceaccountscopes(arrays.aslist(directoryscopes.admin_directory_user , directoryscopes.admin_directory_orgunit)) .setserviceaccountuser(adminemail) .setserviceaccountprivatekeyfromp12file( new java.io.file(serviceaccountpkcs12filepath)) .build();
gmailfilterservice.setoauth2credentials(credential);
added jar files:
- core-1.47.1.jar (new)
- guava.jar (new)
removed jar files:
- gdata-appsforyourdomain-1.0.jar (dead)
- gdata-base-1.0.jar (dead)
- gdata-client-1.0.jar (dead)
- gdata-core-1.0.jar (dead)
- google-collect-1.0-rc1.jar (dead)
- google-oauth-client-appengine-1.20.0.jar (dead)
- google-oauth-client-java6-1.20.0.jar (dead)
- google-oauth-client-jetty-1.20.0.jar (dead)
- google-oauth-client-servlet-1.20.0.jar (dead)
Comments
Post a Comment