Passport strategy for authenticating with Xero using the OAuth 2.0 API.
$ npm install @workablehr/passport-xero-oauth2-v2
This module is based on Passport OAuth2 module. It is used in the same way as other Passport strategies.
passport.use(new XeroStrategy({
clientId: XERO_CLIENT_ID,
clientSecret: XERO_CLIENT_SECRET,
callbackURL: "http://yourapp.io/auth/xero/callback",
passReqToCallback: true
},
function(request, accessToken, refreshToken, profile, done) {
User.findOrCreate({ xero_id: profile.xero_userid }, function (err, user) {
return cb(err, user);
});
}
));