I\'m trying to get the authenticated Facebook user\'s profile picture, to use within a Meteor application. I\'ve tried the following
Meteor.publish(\"facebo
if you want to get picture for facebook
Accounts.onCreateUser(function(options, user) {
if (typeof(user.services.facebook) != "undefined") {
user.services.facebook.picture = "http://graph.facebook.com/" + user.services.facebook.id + "/picture/?type=large";
}
return user;
});
you can to add this helper function
UI.registerHelper("getImageUser", function (userId) {
var user= Meteor.users.findOne(userId);
if (user.services)
{
if (user.services.facebook)
return user.services.facebook.picture;
if (user.services.twitter)
return user.services.twitter.profile_image_url;
if (user.services.google)
return user.services.google.picture;
}
else
{
return "images/withOutPhoto.png";
}
});
in your html
<img src="{{getImageUser this._id}}" alt="...">
Use this instead, you don't need an access token or anything special to get their profile picture, just their facebook user id.
Accounts.onCreateUser(function(options, user) {
if (options.profile) {
options.profile.picture = "http://graph.facebook.com/" + user.services.facebook.id + "/picture/?type=large";
user.profile = options.profile;
}
return user;
});