问题
I want to display photos from my Facebook albums on a website. What would be good way to achieve it?
Do I need oAuth authentication or can I just somewhere grant my website or application access to my albums? I don't want to have a Facebook login or auth dialog on my website.
回答1:
What you need to do:
- Change your privacy settings to that everyone can see your photos. And add permissions for you Facebook application for your user account.
- Authenticate and retrieve access token through OAuth, BUT instead of doing it for the user you do it as the application. Read more about it here: http://developers.facebook.com/docs/authentication/#applogin
- You then call the api method to retrieve albums which is "{ user id }/albums" which will give you a list of your albums.
- Select the album you want to use and then call the api method to retrieve photos in the album which is "{ album id }/photos"
And then you are done, you have a list of all the photos in that album. You even get all the sources for the different dimensions.
来源:https://stackoverflow.com/questions/5708423/facebook-api-how-to-access-my-photo-album