2
votes

I'm developing an Android application and I need to retrieve user profile picture. I already use OAuth to get the token as described here: http://android-developers.blogspot.it/2013/01/verifying-back-end-calls-from-android.html

Any,I'm not able to correctly retrieve user's info. I've tried with this:

https://www.googleapis.com/plus/v1/people/me?key={YOUR_API_KEY}

But I'm not able to understand what's the KEY: On my google console I have:

  • Client ID for web application
  • Client ID for Android application
  • Key for server applications
  • Key for Android applications

Which of them is the correct key? I'm a bit confused. I use the Client ID for web when retrieving the token and to verify it on the backend. I use the Client ID for Android to check on backend side that the issuer is between Authorized Parties. Anyway, when I make a request to:

https://www.googleapis.com/plus/v1/people/me?key={YOUR_API_KEY}

I always get a 401,400,or 403 saying:

  • "Access Not Configured. Please use Google Developers Console to activate the API for your project."
  • Bad Requeset
  • "Invalid Credentials"

and so on.

I've also tried to look at this question with no luck: How to call https://www.googleapis.com/plus/v1/people/me at google

But if I try to query the Google+ API from the Google Cloud Console I successfully get all the info.

What am I doing wrong?

1
Hey @edoardotognoni, I've submitted a bug report on this because neither the Android or iOS Key created in the credentials area, actually work for API calls. If possible, could you star it there so that it might get the proper attention and maybe fixed? URL: code.google.com/p/google-plus-platform/issues/…seaders

1 Answers

3
votes

Preparation

The Getting Started with G+ page explains how you get the Key.

Follow the "Step 1: Enable the Google+ API" and you'll sort it out.

Here's the Google Developers Console snippet: enter image description here

Of course, you have to enable the Google+ API in the console: enter image description here

This is an example "page" inquiry:

https://www.googleapis.com/plus/v1/people/115657794332822874007?key=my_key 

And the result:

{
 "kind": "plus#person",
 "etag": "\"7zDxHg5s5mqDKJRPJZIoOsdfecE/hQCtSSux92KyaIK9CGzq7XZppYY\"",
 "urls": [
  {
   "value": "http://www.osijek360.com",
   "type": "website",
   "label": "www.osijek360.com"
  },
  {
   "value": "https://plus.google.com/+Osijek360/about",
   "type": "other",
   "label": "OSIJEK360 (page)"
  },
  {
   "value": "https://www.facebook.com/OSIJEK360",
   "type": "other",
   "label": "OSIJEK360 (fan page)"
  },
  {
   "value": "http://www.webonjee.com",
   "type": "other",
   "label": "------------------------------------\u003e www.webonjee.com"
  },
  {
   "value": "https://www.facebook.com/webonjee.osijek",
   "type": "other",
   "label": "Webonjee Osijek (profile)"
  },
  {
   "value": "https://www.facebook.com/WEBONJEE",
   "type": "other",
   "label": "WEBONJEE™ (page)"
  },
  {
   "value": "https://www.twitter.com/WEBONJEE",
   "type": "other",
   "label": "WEBONJEE™ (profile)"
  },
  {
   "value": "http://www.linkedin.com/in/webonjee",
   "type": "other",
   "label": "WEBONJEE™ (profile)"
  }
 ],
 "objectType": "page",
 "id": "115657794332822874007",
 "displayName": "OSIJEK360",
 "tagline": "Osječki web portal sa 3D – 360º virtualnim šetnjama i panoramama",
 ...
}

/me request

Once configured correctly, you also need to provide an access_token to be able to use /me request, as explained in the API documentation:

If using the userId value "me", this method requires authentication using a token that has been granted the OAuth scope https://www.googleapis.com/auth/plus.login or https://www.googleapis.com/auth/plus.me. Read more about OAuth.