I am also having problems.
I try to use Java. First, I registered, as I should, a service account.
Downloaded a private key in a keystore formatted as PKCS12.
This is the code I am using:
@Test
public void authenticate() throws Exception {
KeyStore keyStore = KeyStore.getInstance("PKCS12");
keyStore.load(getPKCS12(), "notasecret".toCharArray());
PrivateKey key =
(PrivateKey)keyStore.getKey("privatekey","notasecret".toCharArray());
System.out.println(key.getClass().getName());
GoogleCredential credential = new GoogleCredential.Builder()
.setTransport(new NetHttpTransport())
.setJsonFactory(JacksonFactory.getDefaultInstance())
.setServiceAccountId(SERVICE_ACCOUNT_CLIENT_ID)
.setServiceAccountPrivateKey(key)
.setServiceAccountScopes(singleton("http://picasaweb.google.com/data/"))
//correct scope according to forums
.build();
PicasawebService myService = new
PicasawebService("triptrap-foto-feed");
myService.setOAuth2Credentials(credential);
URL feedUrl = new
URL("https://picasaweb.google.com/data/feed/api/user/6061450663921646098?kind=album");
UserFeed myUserFeed = myService.getFeed(feedUrl, UserFeed.class);
}
In this code, getPKCS12() is a method returning an InputStream to the
pkkcs12 file.
The id in the feedUrl, 6061450663921646098, is the pid that you see when
browsing a google plus album.
When I execute this code, the result is
com.google.gdata.util.ServiceForbiddenException: Forbidden
Token invalid - Invalid token: Cannot parse referred token string
at
com.google.gdata.client.http.HttpGDataRequest.handleErrorResponse(HttpGDataRequest.java:605)
at
com.google.gdata.client.http.GoogleGDataRequest.handleErrorResponse(GoogleGDataRequest.java:564)
at
com.google.gdata.client.http.HttpGDataRequest.checkResponse(HttpGDataRequest.java:560)
at
com.google.gdata.client.http.HttpGDataRequest.execute(HttpGDataRequest.java:538)
at
com.google.gdata.client.http.GoogleGDataRequest.execute(GoogleGDataRequest.java:536)
at com.google.gdata.client.Service.getFeed(Service.java:1135)
at com.google.gdata.client.Service.getFeed(Service.java:998)
at com.google.gdata.client.GoogleService.getFeed(GoogleService.java:645)
at com.google.gdata.client.Service.getFeed(Service.java:1017)
at mypackage.AuthenticationTest.authenticate(AuthenticationTest.java:70)
What am I doing wrong here?
>
>>>
--
You received this message because you are subscribed to the Google Groups
"Google Picasa Web Albums API" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/google-picasa-data-api.
For more options, visit https://groups.google.com/d/optout.