title: How to get Meteor.user() to return on the server side?
body: <p>in a file called /server/main.js (in order to ensure it is loaded last).</p>
  
  <pre><code>console.dir(Meteor.user());
  </code></pre>
  
  <p>Throws:</p>
  
  <pre><code>Error: Meteor.userId can only be invoked in method calls. Use this.userId in publish functions.
  </code></pre>
  
  <p>So I try to use, in the same file:</p>
  
  <pre><code>console.dir(this.userId);
  </code></pre>
  
  <p>returns: </p>
  
  <pre><code>undefined
  </code></pre>
  
  <p>so, not giving up, I'm thinking "that's fine I'll just read from the cookies in the header":</p>
  
  <pre><code>var connect = Npm.require('connect');
  
  __meteor_bootstrap__.app.use(connect.query()).use(function(req, res, next) {
      console.dir(req.headers);
      next();
  });
  </code></pre>
  
  <p>.... returns nothing in terms of cookies except for 'cookie: 'uvf=1''</p>
  
  <p>I'm not sure what to conclude - this is senseless as I can otherwise use the Meteor.Account framework just fine, read/set user properties, etc. The server is clearly aware of the user, and the current user clearly logged in. </p>
  
  <p>I'm at a complete loss, any explanation / hint / pointer would be greatly appreciated.</p>