0.0.1 • Published 9 years ago

passport-scriptr v0.0.1

Weekly downloads
1
License
-
Repository
github
Last release
9 years ago

passport-scriptr

Passport strategy for authenticating with Scriptr using the OAuth 2.0 API.

Install

$ npm install passport-scriptr

Usage

Configure Strategy

The Scriptr authentication strategy authenticates users using a Scriptr account and OAuth 2.0 tokens. The strategy requires a verify callback, which accepts these credentials and calls done , as well as options specifying a client ID, and callback URL.

passport.use(new ScriptrStrategy({
	clientID: "",
	scopes: "execute list manage",
    callbackURL : "",
    failureRedirect : ""
  },
  function(req, accessToken, refreshToken, params, profile, done) {
    	this.saveInfo(req, accessToken, refreshToken, params, profile, done);
  });
));

Authenticate Requests

Use passport.authorize(), specifying the 'scriptr' strategy, to authenticate requests.

For example, as route middleware in an Express application:

app.get('/auth/scriptr',
  passport.authorize('scriptr'));

app.get('/auth/scriptr/callback', 
  passport.authorize('scriptr', { failureRedirect: '/login' }),
  function(req, res) {
    // Successful authentication, redirect home.
    res.redirect('/');
  });

Thanks

License

The MIT License

Copyright (c) 2015 Marvette Feghali