Google Credential: This developer account does not own the application

僤鯓⒐⒋嵵緔 提交于 2019-12-10 01:49:50

问题


I'm using Google client libraries and trying to make a GET request to 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();

I get

 {
  "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."
}

My app is unpublished, would that cause the problem?


回答1:


I've got the same problem. It occurs because you authorize user in Google API who does not own the application and try to get data that belong to your app.

In this topic it is well described. http://support.google.com/googleplay/android-developer/bin/answer.py?hl=en&answer=2528691&topic=16285&ctx=topic

You should authorize by OAuth2 the owner of application, and then use Google API with obtained token.




回答2:


The problem is you are using the Service accounts OAuth 2.0 flow to authorize to the android-publisher API. I was doing it the same way. However, Google requires to use the Web server applications flow, which is ridiculous, since a human interaction is needed to allow for the API access.

Fortunately there is a way around it. You just have to obtain the refresh_token, store that and keep using it for future API calls. I wrote about it in more detail on my blog.




回答3:


We also struggled with this problem as we wanted to validate a purchase on our servers in order to unlock certain features. We tried multiple solutions and frameworks, written by fellow community users and even official implementations but none worked.

Turns out all we had to do was renew our OAuth token (which we just created) and then it all started working.




回答4:


I suspect that problem is exactly in publishing. You first need to bind your app to your (developer) account and then you will receive CLIENT_ID and other credentials (such as secret key and so on).



来源:https://stackoverflow.com/questions/10966945/google-credential-this-developer-account-does-not-own-the-application

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!