gpt4 book ai didi

android - Google Api 返回 "The API (Blogger API) is not enabled for your project.",即使我在控制台中启用了 Blogger API

转载 作者:行者123 更新时间:2023-11-29 01:33:45 26 4
gpt4 key购买 nike

因此,在启用 Blogger Api 之后,我在我的控制台中为我的 Android 应用程序创建了凭据。

我通过以下方式获取我的 token :

final String SCOPE = "oauth2:https://www.googleapis.com/auth/blogger";
mToken = GoogleAuthUtil.getToken(this, email, SCOPE);

然后我将它传递给:

        HttpClient httpclient = new DefaultHttpClient();
HttpGet httpGet = new HttpGet(
"https://www.googleapis.com/blogger/v3/users/self");
httpGet.addHeader("Authorization", "Bearer " + mToken);

HttpResponse response = httpclient.execute(httpGet);
StatusLine statusLine = response.getStatusLine();
if (statusLine.getStatusCode() == HttpStatus.SC_OK) {
ByteArrayOutputStream out = new ByteArrayOutputStream();
response.getEntity().writeTo(out);
String responseString = out.toString();
out.close();
// ..more logic
} else {
// Closes the connection.
response.getEntity().getContent().close();
throw new IOException(statusLine.getReasonPhrase());
}

不知何故,我不断得到:

{
"error": {
"errors": [
{
"domain": "usageLimits",
"reason": "accessNotConfigured",
"message": "Access Not Configured. The API (Blogger API) is not enabled for your project. Please use the Google Developers Console to update your configuration.",
"extendedHelp": "https://console.developers.google.com"
}
],
"code": 403,
"message": "Access Not Configured. The API (Blogger API) is not enabled for your project. Please use the Google Developers Console to update your configuration."
} }

第一次使用电子邮件时确实会出现具有 Blogger 权限的同意屏幕,但在按“确定”后,什么也没有发生,我只在我的日志中看到了这一点

04-23 21:10:46.526: W/System.err(23010): java.io.IOException: Forbidden

我有预感 Google 不匹配包名称/SHA1,即使我已经正确设置了它们。

任何人都可以指出我是否错过了重要的一步/这里做错了什么?任何事情都会有所帮助:)

最佳答案

问题出在我身上。最初,我使用的 SHA-1 指纹是通过 Eclipse > 导出从 APK 中获取的。

SHA-1 google api 询问来自您的 android debug.keystore

来自 https://developers.google.com/+/quickstart/android , 得到它:

In a terminal, run the the Keytool utility to get the SHA-1 fingerprint of the certificate. For the debug.keystore, the password is android.

keytool -exportcert -alias androiddebugkey -keystore <path-to-debug-or-production-keystore> -list -v

Note: For Eclipse on Mac OS or Linux, the debug keystore is typically located at ~/.android/debug.keystore file path. On Windows, the debug keystore is typically located at %USERPROFILE%.android\debug.keystore.

关于android - Google Api 返回 "The API (Blogger API) is not enabled for your project.",即使我在控制台中启用了 Blogger API,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29824799/

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