diff --git a/java/sample/appsforyourdomain/gmailsettings/GmailSettingsService.java b/java/sample/appsforyourdomain/gmailsettings/GmailSettingsService.java index 1569ced5..e8b782f8 100644 --- a/java/sample/appsforyourdomain/gmailsettings/GmailSettingsService.java +++ b/java/sample/appsforyourdomain/gmailsettings/GmailSettingsService.java @@ -16,6 +16,7 @@ package sample.appsforyourdomain.gmailsettings; +import com.google.api.client.auth.oauth2.Credential; import com.google.gdata.client.appsforyourdomain.AppsForYourDomainService; import com.google.gdata.data.appsforyourdomain.AppsForYourDomainException; import com.google.gdata.data.appsforyourdomain.generic.GenericEntry; @@ -68,6 +69,17 @@ public GmailSettingsService( this.setUserCredentials(username + "@" + domain, password); } + public GmailSettingsService( + String applicationName, String domain, Credential credential) + throws AuthenticationException { + super(applicationName, Constants.PROTOCOL, Constants.APPS_APIS_DOMAIN); + this.domain = domain; + + new GenericFeed().declareExtensions(getExtensionProfile()); + + this.setOAuth2Credentials(credential); + } + /** * Retrieve the specified Gmail settings as a GenericFeed *