我正在使用 Google 客户端库并尝试制作 GET
向 Google Play API 请求。
GoogleCredential credential= new GoogleCredential.Builder().setTransport(netHttpTransport)
.setJsonFactory(jacksonFactory)
.setServiceAccountId(CLIENT_ID)
.setServiceAccountScopes(SCOPE)
.setServiceAccountPrivateKeyFromP12File(file)
.build();
credential.refreshToken();
HttpRequestFactory requestFactory =netHttpTransport.createRequestFactory(credential);
GenericUrl url = new GenericUrl(URI);
HttpRequest request = requestFactory.buildGetRequest(url);
HttpResponse response = request.execute();
我得到
{
"code" : 401,
"errors" : [ {
"domain" : "androidpublisher",
"message" : "This developer account does not own the application.",
"reason" : "developerDoesNotOwnApplication"
} ],
"message" : "This developer account does not own the application."
}
我的应用程序未发布,这会导致问题吗?
最佳答案
我有同样的问题。发生这种情况是因为您在 Google API 中授权不拥有该应用程序的用户并尝试获取属于您的应用程序的数据。
在本主题中对其进行了很好的描述。 http://support.google.com/googleplay/android-developer/bin/answer.py?hl=en&answer=2528691&topic=16285&ctx=topic
您应该通过 OAuth2 授权应用程序的所有者,然后使用获得的 token 使用 Google API。
关于google-api - 谷歌凭据 : This developer account does not own the application,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10966945/