In my app I want to show the Google+ profile picture for a user.
The only function, I found, in the API to get the profile picture needs a userId.
However, I only have their email adress and not their Google+ userID.
Moreover the person, whose image I want to get, should not be forced to log in and authorize my app, as this person is mostly not identical to the user of the app.
So I think I need to get their userId by email. I read through the Google+ API documentation but can't find a way to do this, but I can't believe that this is not possible.
So my question is:
How can I get the Google+ userID with only an email address?
Is there maybe an other Google API to get a profile picture?
There is an API provided by https://www.avatarapi.com/ which returns the user's name and profile pic from an email address based on Google's public info.
It can be called via SOAP or HTTP at this API endpoint:
https://www.avatarapi.com/avatar.asmx
One of the benefits of this API is that it does not require the user to be authenticated with Google via OAUTH, so this could be exactly what you are looking for.
You can't do this using just their email address, however, if they paste their Google+ url, you could parse the id from the URL string and then get their profile image (and cover image!) using the public data API. The url: https://plus.google.com/me will bring you to their profile.
I highly doubt this is possible. Any kind of querying against the Google Plus API requires OAUTH. What's more, I'm not aware of way to query for a user ID by email address in the first place.
This thread would seem to confirm that this is currently not possible.
You can use the people.search API to search by email address and without requesting the user to authenticate. However, that will only search the public profile fields, which email is not a public field by default.
The only API methods that require OAuth are those that access private data. For public data, you can use the more simple API key method.
To reliably achieve what you are describing, you'll want to use Oauth and the plus.me scope to get the information that you want. This does require authorizing your app however.