Reputation: 31
So after enabling the Blogger Api, I created the credentials for my Android App in my console.
I am getting my token via:
final String SCOPE = "oauth2:https://www.googleapis.com/auth/blogger";
mToken = GoogleAuthUtil.getToken(this, email, SCOPE);
And then I pass it to:
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());
}
Somehow, I keep getting:
{
"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."
} }
The consent screen with the Blogger permisison does show up when using an email for the first time, but after pressing "OK", nothing happens and I'm only getting this on my logs
04-23 21:10:46.526: W/System.err(23010): java.io.IOException: Forbidden
I have hunch that Google mismatches the package names/SHA1 even though I've set them correctly.
Anyone can point out if I missed an important step/did something wrong here? Anything would help :)
Upvotes: 2
Views: 169
Reputation: 31
The problem was on my part. Originally, the SHA-1 fingerprint I was using was taken from the APK by going through Eclipse > Export.
The SHA-1 google api was asking is from your android debug.keystore
From https://developers.google.com/+/quickstart/android, to get it:
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.
Upvotes: 1