getpocket

nodejs for Pocket

npm install getpocket
19 downloads in the last month

nodejs for Pocket

nodejs for Pocket

Install

First, install the pocket sdk with npm.

npm install getpocket

Functions

  • constructor: (consumer_key, redirect_uri) ->
  • authorizeRoute: (req, res) ->
  • authorize: (callback) ->
  • getAccessToken: (code, callback) ->
  • Pocket.getPocket(options, callback)

Get pocket instance

  config = {
    consumer_key: 'your consumer_key'
    redirect_uri: 'http://example.com/pocket/callback'
  }

  pocket = require('getpocket').getPocket(config)`
or
  Pocket = require('getpocket')
  pocket = new Pocket('consumer_key', 'redirect_uri')

How to use

  # res redirect to pocket auth
  app.get('/pocket/authorize', (req, res) -> pocket.authorizeRoute(req, res))

  app.get('/pocket/callback', (req,res) ->
      pocket.getAccessToken(req.query.code, (err, r) ->
          # r: { access_token: '', username: ''}
          res.json(r)
      )
  )
npm loves you