# passport-strategy-runner

> Run passport stragtegies, without passport.

Latest version **1.0.3** (published 2019-08-22) · MIT license · 0 weekly downloads

## Install

```sh
npm install passport-strategy-runner
pnpm add passport-strategy-runner
yarn add passport-strategy-runner
bun add passport-strategy-runner
```

## Health

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

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.3 |
| Published | 2019-08-22 |
| First published | 2018-05-07 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Node | >=6.0.0 |
| Dependencies | 3 |
| Unpacked size | 10.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Jason Walton |
| Maintainers | jwalton |
| Keywords | passport, security, authentication |

## Links

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

## Dependencies (3)

- [@types/passport](https://npm.io/package/@types/passport.md) ^1.0.0
- [promise-breaker](https://npm.io/package/promise-breaker.md) ^5.0.0
- [@types/passport-strategy](https://npm.io/package/@types/passport-strategy.md) ^0.2.33

## 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.3 (latest) — 2019-08-22
- 1.0.2 — 2018-05-15
- 1.0.1 — 2018-05-10
- 1.0.0 — 2018-05-07

## README

# passport-strategy-runner

[![NPM version](https://badge.fury.io/js/passport-strategy-runner.svg)](https://npmjs.org/package/passport-strategy-runner)
[![Build Status](https://travis-ci.org/jwalton/passport-strategy-runner.svg)](https://travis-ci.org/jwalton/passport-strategy-runner)
[![Coverage Status](https://coveralls.io/repos/jwalton/passport-strategy-runner/badge.svg)](https://coveralls.io/r/jwalton/passport-strategy-runner)
[![Greenkeeper badge](https://badges.greenkeeper.io/jwalton/passport-strategy-runner.svg)](https://greenkeeper.io/)
[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release)

## What is it?

This lets you run a Passport strategy without having Passport involved:

```js
import { BasicStrategy } from 'passport-http';
import { runStrategy } from 'passport-strategy-runner';

const strategy = new BasicStrategy((username, password, done) => {
  done(null, {username: 'jwalton'});
});

const req = {};

// If no callback is supplied, will return a promise.
runStrategy(strategy, req, (err, result) => {
    expect(req.user.username).to.equal('jwalton');
});
```

## Why would you want this?

Maybe you want to write unit tests for your strategy, maybe you want to make
a passport competitor that works with Passport strategies, maybe you just
decided you wanted to figure out how Passport works.  :)

## API

### runStrategy(strategy, request[, options][, done])

Runs the specified strategy, with the specified `request` and the specified `options`.
`options` here is the options object that would be passed to `passport.authenticate(strategy, options)`.
If you do not pass a callback to this function, it will return a Promise which
resolves to the result.  The result will be an object of one of the following
forms:

* `{type: 'success', user, info}`
* `{type: 'fail', challenge, status, message, messageType}`
* `{type: 'redirect', url, status}`
* `{type: 'pass'}`

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