Tiny lib to fetch and refresh an xapp token from Artsy's API.
Last updated 14 days ago by icirellik .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install @artsy/xapp 
SYNC missed versions from official npm registry.


Tiny lib to fetch, store, and refresh an xapp token from Artsy's API.


var artsyXapp = require('artsy-xapp');
  url: 'https://api.artsy.net', // defaults to process.env.ARTSY_URL
  id: '31f31ffds', // defaults to process.env.ARTSY_ID
  secret: '32rf1fds' // defaults to process.env.ARTSY_SECRET
}, function() {
  app.locals.xappToken = artsyXapp.token
artsyXapp.on('error', process.exit);

How it works

ArtsyXapp will fetch an xapp token on init, store the token in artsyXapp.token and refresh the token in the background. If everything goes to hell (e.g. the token is expiring and Artsy's API is down) it will emit an error and null the token—you probably want to crash the server at this point if your app depends deeply on Artsy's API.



Current Tags

  • 1.0.6                                ...           latest (14 days ago)

2 Versions

  • 1.0.6                                ...           14 days ago
  • 1.0.5                                ...           a year ago
Today 0
This Week 0
This Month 7
Last Day 0
Last Week 2
Last Month 13
Dependencies (1)
Dev Dependencies (3)
Dependents (1)

Copyright 2014 - 2016 © taobao.org |