Search code examples
meteortwittermeteor-accounts

How to get twitter profile information with meteors accounts-twitter?


I built a twitter login in my meteor app by using the accounts-twitter package according to the official meteor docs.

However when I try to get the user's Twitter account information by querying:

Meteor.users.find().fetch();

I only get a profile object with the twitter screen name but no other data in it. How can I get the other data, like profile picture, etc. ?

I was expecting a service object containing this information as stated in this tutorial.

I'm using Meteor 1.6 with [email protected]


Solution

  • If you are doing this query on the client side, please be sure that you are actually publishing not only the "profile" field, but also the "services" field. In your publish function make sure you return a cursor like this return Meteor.publish("allUsers", function() { return Meteor.users.find({}, { fields : { profile : 1, services : 1 } }) }) this will publish all users with their profile and service fields only (+ _id which gets included always). Then make sure to subscribe to that publish on your page in order to get that data (this usually happens in the controller for the page) Meteor.subsribe("allUsers"). Then you should be able to see the service fields as well.