Skip to content

Latest commit

 

History

History

fetchToken

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

This Node.js® server allows you to fetch tokens from Facebook and Tumblr. These tokens are necessary to authenticate subsequent request for posting media to those platforms.

  1. dependencies
  2. setup
  3. Troubleshooting

dependencies

developed/tested/used with

  • Node.js
    • 5.9.1
    • 4.3.1
  • npm
    • 3.7.3
  • -nix OS
    • Ubuntu 14.04
    • OSX 10.11
  • Facebook app setup directions here
  • Tumblr app setup directions here
  • server accessible from the internet.
    • if your network does not make this possible, I suggest using ngrok

setup

  1. Ensure your server has a publicly-accessible URL
  • The token-fetching server binds to port 8012. Make sure requests are forwarded to the appropriate port before continuing.
  • If your computer or network configuration make this impractical, read through using ngrok. You will want to start ngrok and keep it running until the entire token fetching process is done, or else you will be assigned a new random Public URL and have to edit your Facebook/Tumblr Apps to reflect the new URL.
    • ngrok http 8012
  1. Go through the Facebook and Tumblr setup instructions for the Sharing webservice.
  2. run npm install in the parent directory to ensure all Node.js dependencies are downloaded.
  3. run npm run token from the parent directory. This will start the token-fetching server on port 8012
  4. double-check that port 8012 is accessible from the internet. (see first step)
  5. confirm that the internet-accessible URL is configured as your App's Domain on both Facebook and Tumblr.
  • If you are using ngrok, once you run the ngrok command an http address will be listed next to "Forwarding". Use the supplied http://***.ngrok.io address for your Facebook and Tumblr apps.
  1. access the Token server in your browser from the internet-accessible URL (not localhost or 127.0.0.1)
  2. follow the prompts to get a Token from Facebook and Tumblr and select the appropriate options for where you want media to be posted.
  3. verify that ../facebookToken.json and ../tumlbrToken.json were created. These are the files that contain your selected options and long-live authentication tokens.
  4. now you can shutdown the Token server (and ngrok if it is running)

Troubleshooting

  • make sure you run npm run token from the parent directory, not this directory
  • The token server uses log4js
    • The script will normally log to rolling files in the log/ directory
    • to enable console logging add {"type":"console"} to the appenders array in log4js_conf.json
    • you can change the logging detail by changing the value of levels.[all], levels.fetchToken, levels.facebook, and/or levels.tumblr in log4js_conf.json to "INFO", "DEBUG", "TRACE", or "ALL"