Here is my credential built using service account,
GoogleCredential credential = new GoogleCredential.Builder()
.setJsonFactory(jsonFactory).setTransport(httpTransport)
.setServiceAccountId("xxxxxxx@developer.gserviceaccount.com")
.setServiceAccountPrivateKeyFromP12File(new File("key.p12"))
.setServiceAccountScopes(Collections.singleton(DirectoryScopes.ADMIN_DIRECTORY_USER))
.build();
And all I am trying is to get a user, where User is com.google.api.services.admin.directory.model.User
User u = null;
try {
u = service.users().get("test@gmail.com").execute();
} catch (Exception e) {
e.printStackTrace();
}
return u.toPrettyString();
}
response returns with code 404 Resource not found?? Is it user need to be created? how to access any gmail user?