# passport-persona

> Mozilla Persona authentication strategy for Passport.

Latest version **0.2.1** (published 2016-11-22) · MIT license · 0 weekly downloads

## Install

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

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.2.1 |
| Published | 2016-11-22 |
| First published | 2013-05-25 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >= 0.4.0 |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 19 |
| Author | Jared Hanson |
| Maintainers | jaredhanson |
| Keywords | passport, persona, browserid, auth, authn, authentication, identity |

## Links

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

## 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

- 0.2.1 (latest) — 2016-11-22
- 0.2.0 — 2016-11-20
- 0.1.7 — 2013-05-25
- 0.1.6 — 2013-05-25
- 0.1.5 — 2013-05-25

## README

# passport-persona

[![Build](https://img.shields.io/travis/jaredhanson/passport-persona.svg)](https://travis-ci.org/jaredhanson/passport-persona)
[![Coverage](https://img.shields.io/coveralls/jaredhanson/passport-persona.svg)](https://coveralls.io/r/jaredhanson/passport-persona)
[![Quality](https://img.shields.io/codeclimate/github/jaredhanson/passport-persona.svg?label=quality)](https://codeclimate.com/github/jaredhanson/passport-persona)
[![Dependencies](https://img.shields.io/david/jaredhanson/passport-persona.svg)](https://david-dm.org/jaredhanson/passport-persona)


[Passport](https://github.com/jaredhanson/passport) strategy for authenticating
with [Mozilla Persona](https://login.persona.org/).

This module lets you authenticate using Mozilla Persona in your Node.js
applications.  By plugging into Passport, Persona 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/).

Persona is a fallback Identity Provider for the [BrowserID](https://developer.mozilla.org/en-US/docs/Mozilla/Persona)
protocol, a distributed login system from [Mozilla](http://www.mozilla.org/).
This strategy verifies assertions using Mozilla's [Remote Verification API](https://developer.mozilla.org/en-US/docs/Mozilla/Persona/Remote_Verification_API).
Applications wishing to verify assertions locally should use
[passport-browserid](https://github.com/jaredhanson/passport-browserid).

## Install

    $ npm install passport-persona

## Usage

#### Configure Strategy

The Persona authentication strategy authenticates users using an assertion of
email address ownership, obtained via the [navigator.id](https://developer.mozilla.org/en-US/docs/Web/API/navigator.id)
JavaScript API.  The strategy requires a `verify` callback, which accepts an
email address and calls `cb` providing a user.

    passport.use(new PersonaStrategy({
        audience: 'http://www.example.com'
      },
      function(email, cb) {
        User.findByEmail({ email: email }, function (err, user) {
          return cb(err, user);
        });
      }
    ));

#### Authenticate Requests

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

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

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

## Examples

For a complete, working example, refer to the [signin example](https://github.com/jaredhanson/passport-persona/tree/master/examples/signin).

## Contributing

#### 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
$ make test
```

#### Coverage

All new feature development is expected to have test coverage.  Patches that
increse test coverage are happily accepted.  Coverage reports can be viewed by
executing:

```bash
$ make test-cov
$ make view-cov
```

## Support

#### Funding

This software is provided to you as open source, free of charge.  The time and
effort to develop and maintain this project is volunteered by [@jaredhanson](https://github.com/jaredhanson).
If you (or your employer) benefit from this project, please consider a financial
contribution.  Your contribution helps continue the efforts that produce this
and other open source software.

Funds are accepted via [PayPal](https://paypal.me/jaredhanson), [Venmo](https://venmo.com/jaredhanson),
and [other](http://jaredhanson.net/pay) methods.  Any amount is appreciated.

## Credits

  - [Jared Hanson](http://github.com/jaredhanson)
  - [Leo McArdle](https://github.com/LeoMcA)

## License

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

Copyright (c) 2011-2016 Jared Hanson <[http://jaredhanson.net/](http://jaredhanson.net/)>

<a target='_blank' rel='nofollow' href='https://app.codesponsor.io/link/vK9dyjRnnWsMzzJTQ57fRJpH/jaredhanson/passport-persona'>  <img alt='Sponsor' width='888' height='68' src='https://app.codesponsor.io/embed/vK9dyjRnnWsMzzJTQ57fRJpH/jaredhanson/passport-persona.svg' /></a>

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