athibanraj / gdata-java-client

Automatically exported from code.google.com/p/gdata-java-client
Apache License 2.0
0 stars 0 forks source link

Contacts api not working when using signed AuthSub token #228

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Name of API affected:
Contacts Data API for Java, AuthSub

Issue summary:
Contact query fails when using signed authsub session token and using 
query.setStringCustomParameter("group", group) query.
Works fine with unsigned session token.
Works fine when removing custom parameter from query (but keeping other 
filters like maxResults etc.)

Steps to reproduce issue:
1. Create an app on appengine
2. Register app with https://www.google.com/accounts/ManageDomains
3. Verify your page and upload a certificate
4. Create valid authsub session token using keystore
5. Create a contact query using custom string parameter (see above)

Expected output:
What do you expect to see after performing the above steps?
Same query result as when using unsigned token

Actual results:
What do you actually see after performing the above steps?

I'll get an exception:
java.lang.NullPointerException: No authentication header information
    at 
com.google.gdata.util.AuthenticationException.initFromAuthHeader(Authentica
tionException.java:96)
    at 
com.google.gdata.util.AuthenticationException.<init>(AuthenticationExceptio
n.java:67)
    at 
com.google.gdata.client.http.HttpGDataRequest.handleErrorResponse(HttpGData
Request.java:564)
    at 
com.google.gdata.client.http.GoogleGDataRequest.handleErrorResponse(GoogleG
DataRequest.java:543)
    at 
com.google.gdata.client.http.HttpGDataRequest.checkResponse(HttpGDataReques
t.java:536)
    at 
com.google.gdata.client.http.HttpGDataRequest.execute(HttpGDataRequest.java
:515)
    at 
com.google.gdata.client.http.GoogleGDataRequest.execute(GoogleGDataRequest.
java:515)
    at com.google.gdata.client.Service.getFeed(Service.java:1053)
    at com.google.gdata.client.Service.getFeed(Service.java:995)
    at 
com.google.gdata.client.GoogleService.getFeed(GoogleService.java:663)
    at com.google.gdata.client.Service.query(Service.java:1155)
    at com.google.gdata.client.Service.query(Service.java:1096)
    at 

Notes:
This is a simplified example how to reproduce the bug:

PrivateKey key = AuthSubUtil.getPrivateKeyFromKeystore("keystore.jks", 
"passwd", "MyApp", "passwd");
contactService.setAuthSubToken(token, key);
URL feedUrl = new URL(CONTACTS_SCOPE + "contacts/" + email + "/full");
Query myQuery = new Query(feedUrl);
myQuery.setMaxResults(5);
myQuery.setStartIndex(1);
myQuery.setStringCustomParameter("group", createdGroupId);                  
ContactFeed resultFeed = contactService.query(myQuery, ContactFeed.class);

Original issue reported on code.google.com by daniel.florey@gmail.com on 21 Jan 2010 at 1:32

GoogleCodeExporter commented 9 years ago
Note: you can work around this error by changing the client library's user 
agent: 
http://stackoverflow.com/questions/26286369/google-contacts-api-failing-to-refre
sh-access-token/26466985#26466985

Original comment by ekoleda+devrel@googlers.com on 20 Oct 2014 at 3:14