HaithemMosbahi / ngx-avatar

Universal avatar component for angular 2+ applications makes it possible to fetch / generate avatar from different sources

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Avatar from Google does not get displayed any more due to Picasa API no longer supported.

slawek-kobiec opened this issue · comments

Javascript Console Errors:

Failed to load resource: the server responded with a status of 400 (Bad Request)
my-rides:1

Access to XMLHttpRequest at 'https://picasaweb.google.com/data/entry/api/user/****?alt=json' from origin 'http://localhost:4200' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.

ngx-avatar.js:984 ngx-avatar: error while fetching google avatar

Google Note:
https://developers.google.com/picasa-web/

ngx-avatar version:
3.2.0

The Picasa web API has been deprecated and all calls to it are being blocked, unless the calleer made a extension request, which is not our case.

I read the migration guide and I couldn't find how to migrate this specifc endpoint.

@odahcam I think we need to use Google Photos API https://developers.google.com/photos/library/guides/overview
I'm not sure if it's possible to retrieve the user avatar with this API. I am going to check the documentation.

Yeah, we need, that's what I found reading the migration guide I linked, but I found nothing about profile pics. I thought about Google+, but that thing is scheduled to die anyway, so I ran out of good options and I searched Stack Overflow which pointed me back to Google+. 😆

Also, the new Google Photos API has very few resources and that's what makes me think that it is just about https://photos.google.com. So I started to think that maybe we gonna need to SignIn the user -> https://developers.google.com/identity/sign-in/web/ (this page shows how to get a BasicProfile.imageUrl) because I'm out of ideas.

https://media1.tenor.com/images/73ff26dcbe661b915169c5ca0ac88722/tenor.gif?itemid=11859478

This may be the solution for our problems:

image

(sorry, but my primary language is portuguese)

Following up with this API, I managed to get my own profile picture:

image

The request URL and its parameters:

GET https://people.googleapis.com/v1/people/{ANY_USERS_ID_OR_ME}?personFields=photos&key={YOUR_API_KEY}

@HaithemMosbahi any plans to fix this using Google People API?