Saturday, July 16, 2022

[FIXED] What is best practice for displaying avatar image in terms of users logging in with facebook

Issue

We are using facebook login on our website and don't know if it is better to actually store the user avatar image on our servers and serve from there or just serve them using the graph API?

I understand the graph API will be more convenient since it will always bring the most up to date photo but I assume there will be restrictions?

Can someone please explain what is best practice when it comes to this?

Thank you.


Solution

Storing the user's image on your DB would add another level of complexity to your application.

What I would suggest is just use the Graph API. It would always return the most current Display Picture of the user and it wouldn't be restricted as it is public data.

The only thing you have to worry about is getting access to THAT public data by having the user Login Using Facebook on your website. You can only access the user's image if the user is logged in to your application.

Once you have that out of the way, you can now have access to the User Image with ease.



Answered By - Edrian
Answer Checked By - Cary Denson (PHPFixing Admin)

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.