检索用户的公开Goog​​le/gmail图片 [英] Retrieving a user's public google/gmail picture

查看:42
本文介绍了检索用户的公开Goog​​le/gmail图片的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用gmail-api编写基于电子邮件的应用程序,并且我需要检索用户公共图片以获取源自Google的电子邮件地址. 我见过其他应用程序可以做到这一点,但是我似乎无法可靠地获取此数据.

更多信息:

  • 我正在使用oauth2登录用户-我在那里请求任何类型的权限都没有问题.
  • 我尝试使用google + api检索图像-但它需要一个userID-而且我不知道如何获取电子邮件地址的userId(gmail-api不会提供它,afaik)
  • 我尝试使用通讯录API-但它仅提供用户通讯录的图像,而电子邮件客户端也可以显示其他用户的图像.

谢谢!

如果我拥有其他用户的用户名,我知道我可以从google plus接收所需的图像.但是,我找不到基于电子邮件地址获取用户ID的方法.

解决方案

非常简单

http://picasaweb.google.com/data/entry/api/user/<hereYourUserIdOrYourEmail>?alt=json

有一个小问题.

您只能直接从gmail获取Google+个人资料的图片.

更新:

该API已被弃用,并将于2019年1月被关闭.请尽快迁移到Google Photos Library API,以避免对您的应用程序造成干扰.

更多信息此处

I'm writing an email-based application using the gmail-api, and i need to retrieve user public images for email address originating from google. I've seen other applications do that, but i can't seem a way to reliably get this data.

some more information:

  • i'm using oauth2 to sign the user in - and i have no problem requesting any type of permissions there.
  • i've tried retrieving the image using the google+ api - but it requires a userID for that - and i don't know how to get the userId for the email address (gmail-api doesn't give it, afaik).
  • i've tried using the contacts API - but it only gives images for the user's contacts, while the email clients can display images from other users as well.

Thanks!

Edit:

I know i can receive the required images from google plus, if i have the other user's userid. however, i can't find a way to get the userid based on an email address.

解决方案

Is very easy

http://picasaweb.google.com/data/entry/api/user/<hereYourUserIdOrYourEmail>?alt=json

just has a little problem.

You only can get the picture of your Google+ profile, not directly from your gmail.

UPDATE:

This API is being deprecated and will be turned down in January 2019. Migrate to Google Photos Library API as soon as possible to avoid disruptions to your application.

More Info Here

这篇关于检索用户的公开Goog​​le/gmail图片的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆