Missing photos in Google Admin Directory Users response - google-admin-sdk

I'm using the Google Admin Directory Users endpoint to retrieve all the users in our company's domain. The request is working as expected and I'm receiving the full list of users.
But a large number of users are missing photos. The thumbnailPhotoUrl property is present on each user entry, but following the URL leads to
https://ssl.gstatic.com/s2/profiles/images/silhouette200.png
which is the default avatar, for a large number of our users.
However:
If I go into Inbox and send one of the users showing the default avatar an email, their profile pic appears when sending the email
And when the user logs in to our app using their company email (using
Firebase Auth), their user response contains a public URL for their avatar
And if I log in to G Suite Admin and view our users, the majority of them have avatars. Only a small handful of users show the silhouette avatar.
Also, the 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.)

Adding some documentation reference to help define the ultimate purpose.
Google API part is here.
Parameter viewType() defines what part of the user profile is returned which in turn depends on GSuite Directory settings. This parameter also defines the level of
authorization when using the Google API.
When using a third party app as defined here, more elements come into play.
In the end, thumbnails appeared...

Related

Using facebook graph api to read photo tags

I am building a website using React and Redux to search facebook photos through tags like my Friends name or by location. User needs to login with facebook so that the application can read its pictures. A user simply puts in the search filters like Tagged users or the location of the picture and my app will show results based on the filters. This will help to find old photos with friends which sometimes get lost on social media due to a large number of photos present(Uploaded or Tagged)
I am trying to fetch mutual photos of me and my friends using my access token and trying to read the tags present in the photos through API but the Response contains only my name in the tags and not other people who are tagged in that photo.
Is there any way to fetch the users who are tagged on a photo uploaded? Any help is appreciated.
Graph api link
Access to any data involving your friends is only possible if those friends specifically authorized your App too. You cannot even get an ID of a friend if he did not authorize your App.
Yes, in order to access involving your friend to authorize your app. But from the details i can see that,
"A user access token may read a photo that the current user is tagged in if they have granted the user_photos or user_posts permission. However, in some cases the photo's owner's privacy settings may not allow your application to access it."
Note: Just need to verify users privacy setting once again.

Security issues , Making social media profile pictures secure

In Facebook API, when we fetch user information we can get profile picture.
The URL is like this:
https://graph.facebook.com/{some_app_user_fb_id}/....
Using this URL, anyone can get the facebook id of the user and can get the facebook account of the user.
My question : Is there any way to make the profile picture URL secure in facebook API or something where no one can make out the original account of the facebook without uploading the profile picture to some other place ?
Similarly I want to ask about google plus profile picture.
The URL is something like this:
https://lh3.googleusercontent.com/{some id}/{something here}/{something}/{somethingelse}/s11-c/photo.jpg
Google picture seems to be more secure, and I don't think anyone can access the main google plus account or gmail email using this picture URL.
2nd Question: So is google plus profile secure ?

Is it possible to display Facebook user photos if someone isn't logged into Facebook?

I'm in the draft stage of designing a charity site for a friend of mine, and we'd like to be able to display photos of people who donate (they would have the choice of turning their photo on or off).
I'm used to logging people into another app of mine via Facebook, and retrieving their basic data.
What I'm wondering is - since the person viewing the site would be the only one logged into it, is it even possible to display photos of Facebook users who have donated ie can you retrieve a FB user photo if they aren't logged in?
If not, are you allowed, with the user's permission, to store their Facebook photo?
Thanks for your time and help.
Have a look at
https://developers.facebook.com/docs/graph-api/reference/v2.2/user/picture/
It's stating
Because profile pictures are always public on Facebook, this call does not require any access token.
This means as long as you requested the public_profile permission upon Facebook Login, and stored the app-scoped user_id in your database somewhere, you can use this app-scoped user_id to generate the profile picture image sources as follows:
<img src="https://graph.facebook.com/{app_scoped_user_id}/picture?type=large&redirect=true"/>
and replace {app_scoped_user_id} by the real app-scoped user_ids in some kind of loop.

Facebook scenario - is this possible?

I'd like to know if the following is possible using Facebook apps:
I'm using the Facebook SDK for .NET and want to create an app that a page will use. The app will take a photograph from a user who happens to visit the page, that photograph should then be sent to one of the page's photo albums.
I've managed to perform this successfully, but only when logged in as the page admin. If I log out of the page admin, log in as my personal Facebook account (as most users of the app will do) then the photograph never gets sent to the pages photo album.
I would like to do all of this when the user uploads the photo, but if it isn't possible I'll need to look into a separate process to actually send the photo's to Facebook, and just store the image on my server until the process runs.
The admin photo album (aka page photo album) is not the same album as non-page admins get to upload to (which is the wall). They are separate buckets all together.
As you mentioned, you can always just upload and store the photos on your server, and then just have a feed item that links over to that image.

How does allauth work when user logs in via social registration

I have been trying to use django-allauth to provide Social registration, but I am having trouble configuring the profiles for the user. There is no documentation of django-allauth which tells
how a django user account is created when a user logs in via a third party such as facebook
What username is assigned to that user and what password is used.
Certain third party providers such as Facebook provide a lot of information about the user such as their name, email etc. so how can we get them and save in the user account/profile
If anybody has used allauth in their projects and can provide some details then it would be really helpful.
I am using django_allauth in my project.
(1) How a django user account is created when a user logs in via a third party such as facebook ?
You should take a look at :
your admin panel and see what happens when somebody logs in.
allauth.facebook.views.login and try to track the login process
It is something like this (in a few words):
When a user logs in your site via his Facebook credentials he is given an access token
This token is saved in the FACEBOOK_ACCESS_TOKENS table (you can see it in the admin panel)
With this access token and with the help of Facebook GraphApi we know his social_id
When we know his social_id - we can have his Facebook account from our database
If we haven't saved it in the db already - we save the Facebook account in the FACEBOOK_ACCOUNTS table (Facebook Accounts in the admin panel)
Then we create a user in the USERS table with the data present in the Facebook account. (you can see the new user in the Users section in the admin panel)
(2) What username is assigned to that user and what password is used ?
As I mentioned before with the help of Facebook GraphApi we get the username of the Facebook user and it is assigned to the User profile as User.username
(3) Certain third party providers such as Facebook provide a lot of information about the user such as their name, email etc. so how can we get them and save in the user account/profile?
Again - the Facebook GraphApi - it gets you the info you need.
I have integrated django_allauth in my site and it is working properly. I will be happy to answer(if I can) if you have more questions.
EDIT - For the avatar support...
I think you have to take a look at the django_allauth settings and particularly in:
SOCIALACCOUNT_AVATAR_SUPPORT (= 'avatar' in settings.INSTALLED_APPS)
Enable support for django-avatar. When enabled, the profile image of
the user is copied locally into django-avatar at signup.