Skip to content
This repository has been archived by the owner on Nov 5, 2022. It is now read-only.

Update GmailSettingsService with OAuth2 #454

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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
*
Expand Down