title: How to make Facebook API calls from server? Which token to use?
body: <p>Could someone please explain the process flow of Facebook API calls from the server side? I understand the general process, but I do not know HOW to do it.</p>
  
  <p>I want my website server to use login credentials (either with <code>user access token</code> or <code>app access token</code>) to periodically send API calls... approx every 15 mins. The purpose of getting the data from the server side is so I can save this data to my own database. For example, the results of the following API call:</p>
  
  <pre><code>`GET/v2.5/2405794352058/feed      // get the latest posts from fb group feed`
  
  // returns an array of objects
  // [{message:'something interesting', id: '23435jlf8923', updated_at: Date()}]
  </code></pre>
  
  <p>In order to make these calls, I must use a <code>user access token</code> or <code>app access token</code>, which will exist for a finite amount of time before needing to re-login. If I opt to use a <code>user access token</code> I will be able to use a variety of tokens to get data and thus it is unlikely I will hit any usage limits. However, if I use an <code>app access token</code> I will have direct control of the access token, but all requests will originate with this same token. Which should I use?</p>
  
  <p>I do not know how to do either of these techniques. The important thing I would like to know is HOW TO DO IT. </p>
  
  <p>Here's what my server code currently looks like (returns 500 internal server error):</p>
  
  <pre><code>router.post('/check_posts', function(req, res, next){
      var accessToken = req.body.accessToken;
      var feed;
  
      FB.api("/142985255268/feed?limit=100",
          {access_token: accessToken},
          function (response) {
            if (response &amp;&amp; !response.error) {
              console.log(response.data);
              feed = response.data;
              res.json(feed);
            }
          }
      );
  });
  </code></pre>
  
  <p>I am using NodeJS, AngularJS, MongoDB and ExpressJS (aka Mean Stack). </p>