I have created a new service account in Google Cloud and configured the corresponding storage objects admin permissions. Then I added this service account in Google Play Console. However, when this account attempts to retrieve financial report data, it prompts me with "does not have storage.objects.list access to the Google Cloud Storage bucket. Permission 'storage.objects.list' denied on resource (or it may not exist)".
@Test
public void execute() throws Exception {
Storage storage = create();
Page<Blob> list = storage.list("Bucket name");
for (Blob blob : list.iterateAll()) {
System.out.println(blob);
}
}
public Storage create() throws Exception {
String projectId = "My project id";
ClassPathResource classPathResource = new ClassPathResource("google/realtalk-c7a20-63be3ffe7b91.json");
InputStream is = classPathResource.getInputStream();
GoogleCredentials credentials = GoogleCredentials.fromStream(is);
return StorageOptions.newBuilder()
.setCredentials(credentials)
.setProjectId(projectId)
.build()
.getService();
}
Why is this happening? Is it because I haven't activated Google Cloud Storage? However, I believe the financial reports in Google Play Console should be stored in Google's own Storage.