Hello, Alain
I faced the same problem with 2 legged OAuth and Contacts API. I'm using
Java and gdata library version 1.46.
My app is installable app in Marketplace (not listed) . I installed it in a
google app domain which I have for experiments.
My app is following the instruction as per:
http://code.google.com/googleapps/marketplace/tutorial_java.html
&
http://code.google.com/p/gdata-java-client/source/browse/trunk/java/sample/oauth/TwoLeggedOAuthExample.java
I have tired all the suggestions suggestions on this topic, discussed in
many Google API forums but always getting this error:
"java.lang.NullPointerException: No authentication header information".
My test code which doesn't work:
ContactsService service = new ContactsService(APP_NAME);
service.useSsl();
GoogleOAuthParameters parameters = new GoogleOAuthParameters();
parameters.setOAuthType(OAuthType.TWO_LEGGED_OAUTH);
parameters.setOAuthConsumerKey(consumerKey);
parameters.setOAuthConsumerSecret(consumerSecret);
parameters.setScope("https://www.google.com/m8/feeds/");
OAuthHmacSha1Signer signer = new OAuthHmacSha1Signer();
service.setOAuthCredentials(parameters, signer);
String url = "https://www.google.com/m8/feeds/contacts/" +
settings.getGoogleName()
+ "/full?xoauth_requestor_id=" + settings.getGoogleName();
System.out.println("URL: " + url);
ContactFeed resultFeed = service.getFeed(new URL(url), ContactFeed.class);
for (ContactEntry contact : resultFeed.getEntries()) {
System.out.println("Contact: " + contact.getId());
}
settings.getGoogleName() returns email address. I tried to
use domain name in first case but in vain.
I've tried to reproduce steps described
in
http://code.google.com/intl/ru-RU/apis/contacts/community/forum.html?place=msg%2Fgoogle-contacts-api%2FKGfd0KXWK-M%2F-JhLi_x3QZwJ
. The code above returned me the same error for
my domain key and secret.
I'm totally puzzled!
SOS! Please, help. Any ideas are welcomed!
--
Regards,
Eugene
--
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