I'm trying to get the authenticated user's profile and picture.
I'm using 2-legged oauth in a google apps domain.
My code looks like:
ContactsService contactsService;
GoogleOAuthParameters oauthParameters;
oauthParameters = new GoogleOAuthParameters();
oauthParameters.setOAuthConsumerKey(consumerKey);
oauthParameters.setOAuthConsumerSecret(consumerSecret);
oauthParameters.setScope("https://www.google.com/m8/feeds/");
oauthParameters.setOAuthType(OAuthType.TWO_LEGGED_OAUTH);
OAuthHmacSha1Signer signer = new OAuthHmacSha1Signer();
contactsService = new ContactsService("marketplace-login");
try {
contactsService.setOAuthCredentials(oauthParameters, signer);
} catch (OAuthException e) {
throw new ServletException("Unable to initialize contacts
service", e);
}
java.net.URL contactFeedUrl = new
java.net.URL("https://www.google.com/m8/feeds/profiles/domain/" +
domainName + "/full/" + userName +
"?xoauth_requestor_id="+loginName+"&v=3.0");
Query query = new Query(contactFeedUrl);
try {
contactsService.setHeader("GData-Version", "3.0");
ContactFeed resultFeed = contactsService.getFeed(query,
ContactFeed.class);
What am I doing wrong?
or
Is there a better way to get the current user's picture when using 2-legged
oauth?
Thanks,
Tom
--
You received this message because you are subscribed to the Google
Groups "Google Contacts, Shared Contacts and User Profiles APIs" group.
To post to this group, send email to
[email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://code.google.com/apis/contacts/community/forum.html