Google Admin Directory用户响应中缺少照片 [英] Missing photos in Google Admin Directory Users response

查看:93
本文介绍了Google Admin Directory用户响应中缺少照片的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Google Admin Directory Users端点检索我们公司域中的所有用户.该请求正在按预期方式工作,我正在收到完整的用户列表.

但是大量用户缺少照片. thumbnailPhotoUrl属性出现在每个用户条目上,但跟随URL会导致

https://ssl.gstatic.com/s2/profiles/images/silhouette200.png

,这是我们大量用户的默认头像.

但是:

  • 如果我进入收件箱"并向显示默认头像的用户之一发送电子邮件,则他们的个人资料照片会在发送电子邮件时出现
  • 当用户使用其公司电子邮件登录到我们的应用程序时(使用 Firebase Auth),他们的用户响应包含其化身的公共网址
  • 如果我登录G Suite管理员并查看我们的用户,则他们中的大多数都有头像.只有一小部分用户显示剪影头像.

此外, docs 状态:

注意:在此版本的API中,照片是用户最新的Gmail聊天个人资料照片.这与Google+个人资料照片不同.

在我们查看过的帐户中,所有用户都拥有Gmail聊天/环聊个人资料照片.

因此,似乎用户拥有与其帐户相关联的照片.为什么Google管理员目录中的照片URL显示默认头像?而不是用户上传的照片吗?

解决方案

我今天遇到了这个问题,在尝试解决问题时发现了您的问题.我想我有答案!

每个用户配置文件中导致silhouette200.pngthumbnailPhotoUrl属性均以https://www.google.com/s2/photos/private/开头,后跟一个长ID字符串.

另一方面,任何返回有效照片(而不是重定向到默认/匿名照片)的用户个人资料都以https://www.google.com/s2/photos/public/ ...开头,例如我的帐户docs state:

Note: In this version of the API, a photo is the user's latest Gmail Chat profile photo. This is different from the Google+ profile photo.

From the accounts we've viewed, all users have Gmail Chat/Hangout profile photos.

So it seems the users have photos associated with their account. Why are the photo URLs in the Google Admin Directory showing the default avatar? And not the user's uploaded photo?

解决方案

I ran into this today and found your question while trying to solve the problem. I think I have the answer!

The thumbnailPhotoUrl property in each of the user profiles that leads to silhouette200.png starts with https://www.google.com/s2/photos/private/ followed by a long id string.

On the other hand, any user profile that returns a valid photo (instead of redirecting to the default/anonymous photo) starts with https://www.google.com/s2/photos/public/ ... like my Google Apps/G Suite profile photo.

I discovered fairly quickly that if I am logged into my G Suite account in the browser where I try to view those thumbnail photos, they resolve as expected with actual photos instead of silhouette200.png.

So: to display G Suite user photos in a custom app, the app user needs to be logged in with a G Suite account that is authorized to read other G Suite domain users' private thumbnail photos

or

your app will need to proxy the photo request in order to return the actual thumbnail.

Of course, please do consider user privacy expectations and regulations; the fact that the profile photo is private usually indicates that the user did not set their own profile photo but had it set by some external application or sync process. (As far as I can tell, when a user sets their own profile photo using My Account or About Me, it is always made public.)

这篇关于Google Admin Directory用户响应中缺少照片的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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