Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/octoblu/passport-xero
Passport Authentication for Xero
https://github.com/octoblu/passport-xero
Last synced: 25 days ago
JSON representation
Passport Authentication for Xero
- Host: GitHub
- URL: https://github.com/octoblu/passport-xero
- Owner: octoblu
- License: mit
- Created: 2014-10-13T22:08:43.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2017-04-20T16:16:15.000Z (almost 8 years ago)
- Last Synced: 2024-04-26T15:20:51.126Z (9 months ago)
- Language: JavaScript
- Size: 2.93 KB
- Stars: 6
- Watchers: 19
- Forks: 7
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# passport-xero
[Passport](http://passportjs.org/) strategy for authenticating with [Smart Sheets](http://xero.com/)
using the OAuth 1.0a API.This module lets you authenticate using Smart Sheets in your Node.js applications.
By plugging into Passport, Smart Sheets authentication can be easily and
unobtrusively integrated into any application or framework that supports
[Connect](http://www.senchalabs.org/connect/)-style middleware, including
[Express](http://expressjs.com/).## Install
$ npm install passport-xero
## Usage
#### Configure Strategy
var XeroStrategy = require('passport-xero');passport.use(new XeroStrategy({
consumerKey : XERO_CLIENT_KEY,
consumerSecret: XERO_CLIENT_SECRET,
callbackURL: "http://127.0.0.1:3000/auth/xero/callback"
},
function(token, tokenSecret, profile, done) {
User.findOrCreate({ xeroId: profile.id }, function (err, user) {
return done(err, user);
});
}
));#### Authenticate Requests
Use `passport.authenticate()`, specifying the `'xero'` strategy, to
authenticate requests.For example, as route middleware in an [Express](http://expressjs.com/)
application:app.get('/auth/xero',
passport.authenticate('xero'));app.get('/auth/xero/callback',
passport.authenticate('xero', { failureRedirect: '/login' }),
function(req, res) {
// Successful authentication, redirect home.
res.redirect('/');
});## License
[The MIT License](http://opensource.org/licenses/MIT)