google-api-java-client : 1.18.0-rc
The example code at this place must be updated :
https://code.google.com/p/google-api-java-client/wiki/OAuth2#Service_Accounts
With the old API the code was :
GoogleCredential credential = new
GoogleCredential.Builder().setTransport(HTTP_TRANSPORT)
.setJsonFactory(JSON_FACTORY)
.setServiceAccountId("[[INSERT SERVICE ACCOUNT EMAIL HERE]]")
.setServiceAccountScopes(PlusScopes.PLUS_ME)
.setServiceAccountPrivateKeyFromP12File(new File("key.p12"))
// .setServiceAccountUser("user@example.com")
.build();
But now, he must like :
private static final List<String> SCOPES = Arrays.asList(
PlusScopes.PLUS_ME);
GoogleCredential credential = new
GoogleCredential.Builder().setTransport(HTTP_TRANSPORT)
.setJsonFactory(JSON_FACTORY)
.setServiceAccountId("[[INSERT SERVICE ACCOUNT EMAIL HERE]]")
.setServiceAccountScopes(SCOPES)
.setServiceAccountPrivateKeyFromP12File(new File("key.p12"))
// .setServiceAccountUser("user@example.com")
.build();
Original issue reported on code.google.com by sebastie...@progis.fr on 5 Jun 2014 at 9:38
Original issue reported on code.google.com by
sebastie...@progis.fr
on 5 Jun 2014 at 9:38