gpt4 book ai didi

in-app-purchase - Google Play API返回错误

转载 作者:行者123 更新时间:2023-12-02 09:41:47 24 4
gpt4 key购买 nike

我遇到了this post中所述的相同问题

。我们使用了几乎完全相同的代码。我在mehotd下面尝试了客户ID和谷歌服务帐户的电子邮件地址

setServiceAccountId(GOOGLE_SERVICE_CLIENT_EMAIL) OR
setServiceAccountId(GOOGLE_CLIENT_ID)

错误随着A / C ID的变化而变化。如果我使用客户端ID,则错误为

400 Bad Request { "error" : "invalid_grant" }



如果我使用服务电子邮件ID,则错误为
401 Unauthorized {   
"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 Play API当前不适用于服务帐户(疯狂)。关于问题here,还有另一个主题。您可以阅读有关Google服务帐户here的信息。您可以阅读有关Android Google Play API here的身份验证的信息。

在Google API控制台上完成跳舞以获取refresh_token之后,您将获得如下访问 token :

private String getAccessToken()
{

HttpClient client = new DefaultHttpClient();
HttpPost post = new HttpPost("https://accounts.google.com/o/oauth2/token");
try
{
List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(4);
nameValuePairs.add(new BasicNameValuePair("grant_type", "refresh_token"));
nameValuePairs.add(new BasicNameValuePair("client_id", "YOUR_CLIENT_ID);
nameValuePairs.add(new BasicNameValuePair("client_secret", "YOUR_CLIENT_SECRET"));
nameValuePairs.add(new BasicNameValuePair("refresh_token", "YOUR_REFRESH_TOKEN"));
post.setEntity(new UrlEncodedFormEntity(nameValuePairs));

HttpResponse response = client.execute(post);
BufferedReader reader = new BufferedReader(new InputStreamReader(response.getEntity().getContent()));
StringBuffer buffer = new StringBuffer();
for (String line = reader.readLine(); line != null; line = reader.readLine())
{
buffer.append(line);
}

JSONObject json = new JSONObject(buffer.toString());
return json.getString("access_token");
}
catch (IOException e) { e.printStackTrace(); }
catch (JSONException e) { e.printStackTrace(); }
return null;
}

关于in-app-purchase - Google Play API返回错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11258349/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com