Need Package Maintenance
    Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

    passport-avalonpublic

    Passport-Avalon

    Node.js passport connector for Avalon OAuth servers, based on mjpearson's wordpress passport connector.

    Passport strategy for authenticating with Avalon Federated Login using the OAuth 2.0 API.

    Install

    $ npm install passport-avalon
    

    Usage

    Configure Strategy

    The Avalon authentication strategy authenticates users using an Avalon login 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 client ID, client secret, and callback URL.

    passport.use(new AvalonStrategy({
        clientID: CLIENT_ID,
        clientSecret: CLIENT_SECRET
      },
      function(accessToken, refreshToken, profile, done) {
        User.findOrCreate({ WordpressId: profile.id }, function (err, user) {
          return done(err, user);
        });
      }
    ));
    

    Authenticate Requests

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

    For example, as route middleware in an Express application:

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

    Thanks

    License

    The MIT License

    Copyright (c) 2014 Avalon Consulting LLC

    install

    npm i passport-avalon

    Downloadsweekly downloads

    1

    version

    0.0.1

    license

    none

    repository

    githubgithub

    last publish

    collaborators

    • avatar