Passport-EchoSign
Passport strategy for authenticating with EchoSign using the OAuth 2.0 API.
This module lets you authenticate using EchoSign in your Node.js applications. By plugging into Passport, EchoSign authentication can be easily and unobtrusively integrated into any application or framework that supports Connect-style middleware, including Express.
Usage
Configure Strategy
The EchoSign authentication strategy authenticates users using a EchoSign
account and OAuth 2.0 tokens. The strategy requires a verify
callback, which
accepts these credentials and calls done
providing a user, as well as
options
specifying a app ID, app secret, and callback URL.
passport.use(new EchoSignStrategy({
clientID: ECHOSIGN_APP_ID,
clientSecret: ECHOSIGN_APP_SECRET,
callbackURL: "http://localhost:3000/auth/echosign/callback"
}, function (accessToken, refreshToken, profile, done) {
// store credentials, etc
});
}
));
Authenticate Requests
Use passport.authenticate()
, specifying the 'echosign'
strategy, to
authenticate requests.
For example, as route middleware in an Express application:
app.get('/auth/echosign', passport.authenticate('echosign'));
app.get('/auth/echosign/callback',
passport.authenticate('echosign', { failureRedirect: '/login' }),
function(req, res) {
// Successul authentication, redirect home.
res.redirect('/');
});
Credits
Created by Joe Woodhouse
Code based on passport-mailchimp by Brian Falk