Facebook images missing
-
Hello Community.
I noticed that imageUrl of users logged in via the Facebook IDP expire when a user doesn't login regularly. Is there any possibility to cache those images within fusionauth or do I need to take care of it myself? The images clearly expire on Facebooks side (only IDP I've tested so far). Image requests (which previously worked) respond with a 404.
Before implementing my own strategy I want to make sure there isn't a better way.My solution would look as follows:
- Register a webhook which listens to the
user.login
event, read users imageUrl Property. - On my Backend, I'd fetch the image and create a copy of it on my backend, storing it in an s3 bucket or someplace else.
- Then update the user in fa with a url pointing to the copy in a property under
data
(likedata.avatarUrl
). - On the frontend I'd always use the url pointing to the copy.
This would update users image on every login via IDP while allowing the use of
data.avatarUrl
for manually uploaded avatars as well.Is there a better way?
- Register a webhook which listens to the
-
So, this appears to be a limitation of Facebook. Here are the API docs from Facebook which have no mention of how long the image URL returned if you pass
redirect=0
is good for.Looks like some Auth0 users also encountered this.
So I think you are on the right path with downloading the user's Facebook images and updating them on your side every time a user logs in.