Google凭据:此开发者帐户不拥有该应用程序

use*_*845 11 google-api google-api-java-client

我正在使用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();
Run Code Online (Sandbox Code Playgroud)

我明白了

 {
  "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."
}
Run Code Online (Sandbox Code Playgroud)

我的应用程序未发布,会导致问题吗?

ikr*_*nko 6

我有同样的问题.之所以出现这种情况,是因为您授权Google API中的用户不拥有该应用并尝试获取属于您应用的数据.

在这个主题中,它被很好地描述.http://support.google.com/googleplay/android-developer/bin/answer.py?hl=en&answer=2528691&topic=16285&ctx=topic

您应该通过OAuth2授权应用程序的所有者,然后使用Google API获取令牌.


Ill*_*ych 0

我怀疑问题出在出版方面。您首先需要将您的应用程序绑定到您的(开发者)帐户,然后您将收到 CLIENT_ID 和其他凭据(例如密钥等)。