Neoclassic Placebo Maker
    Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

    express-tumblr-oauthpublic

    express-tumblr-oauth

    Drop in Tumblr API with OAuth for Express.

    How

    npm install express-tumblr-oauth
    

    Pass your express app through this module and you'll have Tumblr API capabilities.

    // ======
    // app.js
    // ======
    var express = require("express")
      , app = express()
      , tumblrAPI = require("express-tumblr-oauth")
     
    var config =
      { oauth:
          { consumer_secret: "YOURSECRETKEY"
          , consumer_key: "YOURCONSUMERKEY"
          , callback: "http://localhost:3000"
          }
      }
     
    tumblrAPI(app, config)
     
    app.listen(3000)

    NOTE:

    config.oauth.callback should be the base url of your website it will be converted into an appropriate callback url for oauth internally by express-tumblr-oauth

    Interface

    express-tumblr-oauth adds the following routes to your application

    /api/oauth/tumblr/url

    $.getJSON("/api/oauth/tumblr/url", function (url) {
      console.log(url) // http://www.tumblr.com/authorize?oauth_token=[oauthtoken]
    })

    /api/oauth/tumblr/callback

    express-tumblr-oauth uses this callback internally to finilize the oauth proccess.

    /api/tumblr/*

    works as an authorized proxy to the official tumblr API

    $.getJSON("/api/tumblr/dashboard", function (data) {
      console.log(data.meta.status) // 200
    })

    Config options

    These are all the options you can pass express-tumblr-oauth and their defaults

    var ops = {}
     
    // REQUIRED
    ops.oauth =
      { consumer_key: "key"
      , consumer_secret: "secret"
      , callback: "mywebsite.com"
      }
     
    //OPTIONAL
     
    ops.sessionName = "tumblr_oauth"
    // used as the variable inside the req.session
    // express object.
     
    ops.successRedirect =  "/"
    // the path to redirect to when oauth is successfully complete
     
    ops.failureRedirect =  "/"
    // the path to redirect to when oauth fails
     
     

    install

    npm i express-tumblr-oauth

    Downloadsweekly downloads

    9

    version

    0.0.7

    license

    MIT

    repository

    githubgithub

    last publish

    collaborators

    • avatar