Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Meteor shortcut to get the profile picture for the currently logged in user, regardless of platform

There are questions about getting the profile image from Twitter, Facebook or Google, but it would be nice if there were a simple and extensible wrapper that returned the profile image regardless of the current user's account service.

like image 218
Dan Dascalescu Avatar asked Sep 16 '13 11:09

Dan Dascalescu


2 Answers

I think you would want to set the users profile picture yourself. Because the services do not have a standard way to store profile picture. And the meteor oauth has no required code for each service class to implement.

You could set it on account creation. This would require writing code for each service.

Accounts.onCreateUser(function (options, user) {


    if (user.services.google !== undefined) {

        user.profile.profile_picture = user.services.google.picture;

    }
  if (user.services.twitter !== undefined) {

        user.twitter.profile_picture = user.services.twitter.profile_url; // sudo param name

    }
    return user;
})

or on publish.

like image 180
adrianj98 Avatar answered Sep 25 '22 05:09

adrianj98


In the meantime there is an Atmosphere package that returns the user profile picture and works for a lot of auth services:

bengott:avatar

like image 44
Dan Dascalescu Avatar answered Sep 21 '22 05:09

Dan Dascalescu