5

I'm retrieving user data from Google using the Passport Google Strategy (OAuth 2.0). This works fine except when the logged-in user does not have an explicitly set profile picture. In such cases, Google returns a default image with the user's first-name initial:

enter image description here

I want to be able to tell if the image returned by the API is a real image or something like this. How do I accomplish this? There's a similar question here but the answer is outdated since Google no longer seems to offer an isDefault flag. Nor does it have a consistent URI for the default silhouette because the auto-generated image is different for different users depending on their initials. Is there any alternative flag offered by Google OAuth 2.0 that tells me if the image is an auto-generated one?

TheLearner
  • 2,813
  • 5
  • 46
  • 94
  • 2
    try checking out this answer: https://stackoverflow.com/a/62437962/14068351 – Geo Aug 10 '20 at 17:31
  • I tried to execute the example given here: https://developers.google.com/people/api/rest/v1/people/get?apix_params=%7B%22resourceName%22%3A%22people%2Fme%22%2C%22personFields%22%3A%22photos%22%7D and it did not respond with any value of "DEFAULT" True/false (so I can not tell if this is a default image or an uploade done) – bodomalo Aug 10 '23 at 09:15

0 Answers0