# passport-civic

> [Passport](http://passportjs.org/) strategy for authenticating with [Civic](https://www.civic.com/)

Latest version **1.0.6** (published 2018-02-12) · MIT license · 0 weekly downloads

## Install

```sh
npm install passport-civic
pnpm add passport-civic
yarn add passport-civic
bun add passport-civic
```

## 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.0.6 |
| Published | 2018-02-12 |
| First published | 2017-09-14 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 4.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 5 |
| Author | Vinay Agarwal |
| Maintainers | kar2905, springrole1, vinay035 |
| Keywords | passport, civic, auth, authn, authentication, identity |

## Links

- npm: https://www.npmjs.com/package/passport-civic
- Repository: https://github.com/SpringRole/passport-civic
- Issues: http://github.com/SpringRole/passport-civic/issues
- npm.io page: https://npm.io/package/passport-civic

## Dependencies (2)

- [civic-sip-api](https://npm.io/package/civic-sip-api.md) ^0.4.2
- [passport-strategy](https://npm.io/package/passport-strategy.md) ^1.0.0

## Alternatives

- [@clerk/clerk-expo](https://npm.io/package/@clerk/clerk-expo.md) — 133.6K weekly downloads
- [@pothos/plugin-authz](https://npm.io/package/@pothos/plugin-authz.md) — 12.4K weekly downloads
- [@bounded-sh/client](https://npm.io/package/@bounded-sh/client.md) — 3.2K weekly downloads
- [@luigi-project/plugin-auth-oauth2](https://npm.io/package/@luigi-project/plugin-auth-oauth2.md) — 2.3K weekly downloads
- [@nocobase/plugin-verification](https://npm.io/package/@nocobase/plugin-verification.md) — 2.0K weekly downloads

## Recent versions

- 1.0.6 (latest) — 2018-02-12
- 1.0.5 — 2017-10-09
- 1.0.4 — 2017-10-03
- 1.0.3 — 2017-09-18
- 1.0.2 — 2017-09-14
- 1.0.1 — 2017-09-14
- 1.0.0 — 2017-09-14

## README

# passport-civic

[Passport](http://passportjs.org/) strategy for authenticating with [Civic](https://www.civic.com/)

This module lets you authenticate using Civic in your Node.js applications.
By plugging into Passport, Civic authentication can be easily and
unobtrusively integrated into any application or framework that supports
[Connect](http://www.senchalabs.org/connect/)-style middleware, including
[Express](http://expressjs.com/).

## Install

    $ npm install passport-civic

## Usage

#### Configure Strategy

The Civic authentication strategy authenticates users using a Civic
app.  The strategy requires a `verify` callback, which
accepts these credentials and calls `done` providing a user, as well as
`options` specifying a appId, prvKey, and appSecret.

    passport.use(new CivicStrategy({
        appId: APP_ID,
        prvKey: PRIVATE_KEY,
        appSecret: "Something-secret"
      },
      function(profile, done) {
        User.findOrCreate({ civicId: profile.userId }, function (err, user) {
          return done(err, user);
        });
      }
    ));

#### Parameters

The verify callback can be supplied with the `request` object by setting
the `passReqToCallback` option to true, and changing callback arguments
accordingly.

    passport.use(new CivicStrategy({
        appId: APP_ID,
        prvKey: PRIVATE_KEY,
        appSecret: "Something-secret"
        passReqToCallback: true
      },
      function(req, profile, done) {
        // request object is now first argument
        // ...
      }
    ));

#### Authenticate Requests

Use `passport.authenticate()`, specifying the `'civic'` strategy, to
authenticate requests.

For example, as route middleware in an [Express](http://expressjs.com/)
application:

    app.get('/auth/civic',
      passport.authenticate('civic'));

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

## Credits

  - [Vinay Agarwal](http://github.com/vinay035)
  - [Kartik Mandaville](http://github.com/kar2905)

## License

[The MIT License](http://opensource.org/licenses/MIT)

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