# passport-affinity

> Authenticate using userEmail and apiKey for Passport.

Latest version **1.0.0** (published 2023-07-15) · 0 weekly downloads

## Install

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

## 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.0 |
| Published | 2023-07-15 |
| First published | 2023-07-15 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >= 0.4.0 |
| Dependencies | 1 |
| Unpacked size | 4.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Ramachandran Perumal |
| Maintainers | raman99444 |
| Keywords | passport, local, auth, authn, authentication, userEmail, apiKey, crmId |

## Links

- npm: https://www.npmjs.com/package/passport-affinity
- Repository: https://github.com/Raman99444/passport-affinity
- Homepage: https://github.com/Raman99444/passport-affinity#readme
- Issues: https://github.com/Raman99444/passport-affinity/issues
- npm.io page: https://npm.io/package/passport-affinity

## Dependencies (1)

- [passport-strategy](https://npm.io/package/passport-strategy.md) 1.x.x

## Alternatives

- [@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
- [escher-request](https://npm.io/package/escher-request.md) — 545 weekly downloads

## Recent versions

- 1.0.0 (latest) — 2023-07-15

## README

# passport-affinity

## Install

    $ npm install passport-affinity

## Usage

#### Configure Strategy

The affinity authentication strategy authenticates users using a userEmail and
apiKey.  The strategy requires a `verify` callback, which accepts these
credentials and calls `done` providing a user.

    passport.use(new AffinityStrategy(
      async (userEmail, apiKey, crmId, done) {
        //handle the user requirement here
      }
    ));

#### Authenticate Requests

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

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

    app.post('/login', 
      passport.authenticate('affinity', { failureRedirect: '/login' }),
      function(req, res) {
        res.redirect('/');
      });


## Tests

    $ npm install

## License

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

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