# @ghg/passport-gh-portal-strategy

> ## Install

Latest version **1.1.6** (published 2023-07-18) · MIT license · 0 weekly downloads

## Install

```sh
npm install @ghg/passport-gh-portal-strategy
pnpm add @ghg/passport-gh-portal-strategy
yarn add @ghg/passport-gh-portal-strategy
bun add @ghg/passport-gh-portal-strategy
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.6 |
| Published | 2023-07-18 |
| First published | 2019-09-16 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 15.4 KB |
| Known vulnerabilities | 0 (+25 in 1 direct dependencies) |
| Install scripts | no |
| Author | Luke van der Palen |
| Maintainers | jimghg, meh-greenhouse, lukevdpalen, rickstv, iamrobin, josvdmanakker, kreumkens, shanevdb |

## Links

- npm: https://www.npmjs.com/package/@ghg/passport-gh-portal-strategy
- npm.io page: https://npm.io/package/@ghg/passport-gh-portal-strategy

## Dependencies (2)

- [axios](https://npm.io/package/axios.md) ^0.19.0
- [passport-strategy](https://npm.io/package/passport-strategy.md) ^1.0.0

## Recent versions

- 1.1.6 (latest) — 2023-07-18
- 1.1.5 — 2022-01-10
- 1.1.4 — 2021-02-10
- 1.1.3 — 2021-02-10
- 1.1.2 — 2021-01-20
- 1.1.0 — 2020-11-30
- 1.0.1 — 2019-09-16
- 1.0.0 — 2019-09-16

## README

# passport-gh-portal-strategy

## Install

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

## Usage

#### Configure Basic Strategy

```js
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](http://expressjs.com/)
application:

```js
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:

```bash
$ yarn test
```

---
_Source: https://npm.io/package/@ghg/passport-gh-portal-strategy · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
