Facebook "offline" access using Node

I wanted to fetch Lunch menus for my Lunch project (now defunkt) also from Facebook pages: it turns out some of the local restaurants only
update the daily lunch menu on their Facebook pages. This was pretty simple to do using the facebook-node-sdk Node.js library.
The only slight complication concerned getting a valid access token. In order to access a Page's feed posts, you need a valid access token: you can't access the
information anonymously. Since my script is running on the server this posed a bit of a problem, because the normal access tokens Facbook issues
are only valid for two hours, and they recently removed the 'offline access' permission to let you use tokens indefinitely. So somehow I needed
to generate a valid token for my server side script to use.

Luckily it turns out the Node module has support for this built in. All we need is to set up an app in Facebook, then using the app id and the app secret
generated we can use the following code (no error handling here for brevity):

FB.api('oauth/access_token', {
    client_id: 'your_client_id_here',
    client_secret: 'your_secret_here',
    grant_type: 'client_credentials'
}, (res) ->