Is this a bug? Accessing services.facebook and services.twitter in rendered section via


So yeah, I’m trying to debug what happens after the social login thing in my app. So I’m using the FB and Twitter social logins. I’m trying to access user data from Meteor.users (because this is a profile page) right after the login and need to access the data in the rendered section of a template. So my code looks like this:

Template.profile.rendered = function() {
var self = this;
// Do something with

I’m using Iron Router and I have it so that the subscription publishes all of the user’s properties for testing purposes. I noticed that:

  1. When I’m logged in for the first time as a facebook user, and exists.
  2. When I’m logged in for the first time as a Twitter user, is missing.

If I do a Meteor.user() in the console, I can see that in both cases, both are there, but why is it the above the case for in the rendered() section?

Generally speaking, data is not always available to a template when it is first rendered.

Rendered means “hey I (the template) am here and I will now look for the data”

What you can do is wrap a Tracker around your console.log( to set up a reactive computation on your users client side collection and console.log( the changes as they come in.

Regarding the difference with Facebook and Twitter, well, it may be related to the difference in response times you get from their authentication services. Facebook’s might just be fast enough so you get that data as soon as the template renders while Twitter’s is lagging behind.

PS: I’m not exactly sure about that last paragraph, but my gut instinct says that should be crossed off the list first.

Ah, that must be it. But anyway, I just resorted to using template helpers and using Sessions to get and store the data from a reactive source and access it in the rendered block.

Not sure if you already noticed that meteor has updated tonight to release 1.0.5 and made some updates to facebook api - Maybe you have a look on that either