title: How to use Facebook Login in a Meteor App
body: <p>I'm trying to create a custom login only using Facebook and only looking for two endpoints: "name" and "avatar".</p>
  
  <p>For starters I don't know if "avatar" is even a real endpoint name but that's what I'm trying to access.</p>
  
  <p>I have created a test app on FB, I have also installed all of the Meteor packages that I need so the groundwork is done.</p>
  
  <pre><code>I've create the following template:
  &lt;template name="Login"&gt;
      &lt;h2&gt;Login&lt;/h2&gt;
      {{#if currentUser}}
          {{currentUser.services.facebook.name}}
          {{currentUser.services.facebook.avatar}}
          &lt;button id="logout"&gt;Logout&lt;/button&gt;
      {{else}}
          &lt;button id="facebook-login" class="btn btn-default"&gt;Login with Facebook&lt;/button&gt;
      {{/if}}
  &lt;/template&gt;
  </code></pre>
  
  <p>and then in the SERVERS directory I have create a .js file to store my API keys.</p>
  
  <p>My questions:</p>
  
  <p>My first question is where to find the names of these endpoints as I've been going the entire documentation on FB and nothing references "name" or "avatar" so the first thing I need to understand is where to find these endpoints as I haven't been able to locate even the "name".</p>
  
  <p>Second question is the API shows JSON objects and that's usually how you would hookup your endpoints but in Meteor since all of that is abstracted it's unclear where this "facebook" object exists to then study more in depth the nested properties like "name" and "avatar" (which again i'm uncertain if that is the correct name for that property). I'm assuming because I'm using Meteor that calling an endpoint like this <code>{{currentUser.services.facebook.name}}</code> is enough, am I thinking about this correctly?</p>
  
  <p>Final question is if I have to call these endpoints like this inside of my template:</p>
  
  <pre><code>{{#if currentUser}}
          {{currentUser.services.facebook.name}}
          {{currentUser.services.facebook.gender}}
          &lt;button id="logout"&gt;Logout&lt;/button&gt;
      {{else}}
          &lt;button id="facebook-login" class="btn btn-default"&gt;Login with Facebook&lt;/button&gt;
      {{/if}}
  </code></pre>
  
  <p>Then even if I wrap my facebook name and gender in their own divs like this:</p>
  
  <pre><code>{{#if currentUser}}
          &lt;div class="name"&gt;
              {{currentUser.services.facebook.name}}
          &lt;/div&gt;
          &lt;div class="avatar"&gt;
              {{currentUser.services.facebook.avatar}}
          &lt;/div&gt;
          &lt;button id="logout"&gt;Logout&lt;/button&gt;
      {{else}}
          &lt;button id="facebook-login" class="btn btn-default"&gt;Login with Facebook&lt;/button&gt;
      {{/if}}
  </code></pre>
  
  <p>This still doesn't make it very obvious to me how to move it say the header?</p>
  
  <p>So in other words how would I have the user login from the main body of the page, yet after they login have the actually username and avatar up in the header?</p>
  
  <p>There is no obvious way for me to do this. </p>
  
  <p>What am I missing? How would I DOM shuffle to move the .name and .avatar divs to the header when I just logged the user in via the body of the page?</p>
  
  <p>Does this make sense?</p>
  
  <p>My hunch is that I would have to create another template within the header that calls these values?</p>
  
  <p>Anyone play around with this that could offer some insight?</p>
  
  <p>Thank you.</p>