1.1.6 • Published 10 months ago

@ghg/passport-gh-portal-strategy v1.1.6

Weekly downloads
165
License
MIT
Repository
-
Last release
10 months ago

passport-gh-portal-strategy

Install

$ yarn add @ghg/passport-gh-portal-strategy

Usage

Configure Basic Strategy

const {
    BasicStrategy: BasicGHPortalStrategy,
} = require('@ghg/passport-gh-portal-strategy');

passport.use(
    new BasicGHPortalStrategy(
        { callbackURL: 'http://localhost:3000/auth/callback' },
        function(accessToken, profile, done) {
            User.findOrCreate({ email: profile.email }, function(err, user) {
                return done(err, user);
            });
        },
    ),
);

Authenticate Requests

Use passport.authenticate(), specifying the 'gh-portal-basic' strategy, to authenticate requests.

For example, as route middleware in an Express application:

app.get('/auth/example', passport.authenticate('gh-portal-basic'));

app.get(
    '/auth/example/callback',
    passport.authenticate('gh-portal-basic'),
    function(req, res) {
        // Successful authentication, redirect home.
        res.redirect('/');
    },
);

Todo

  • Create strategy for Application Token Strategy

Tests

The test suite is located in the test/ directory. All new features are expected to have corresponding test cases. Ensure that the complete test suite passes by executing:

$ yarn test
1.1.6

10 months ago

1.1.5

2 years ago

1.1.4

3 years ago

1.1.3

3 years ago

1.1.2

3 years ago

1.1.1

3 years ago

1.1.0

3 years ago

1.0.1

5 years ago

1.0.0

5 years ago