# @reshuffle/passport

> Passport strategy for reshuffle authentication

Latest version **0.2.0** (published 2019-12-01) · MIT license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install @reshuffle/passport
pnpm add @reshuffle/passport
yarn add @reshuffle/passport
bun add @reshuffle/passport
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 0.2.0 |
| Published | 2019-12-01 |
| First published | 2019-11-18 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 8 |
| Unpacked size | 50.5 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 122 |
| Author | Ariel Shaqed |
| Maintainers | binaris, taillogs |
| Keywords | passport, strategy, authentication, auth, reshuffle, session |

## Links

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

## Dependencies (8)

- [passport](https://npm.io/package/passport.md) ^0.4.0
- [stringcase](https://npm.io/package/stringcase.md) ^4.3.1
- [@types/node](https://npm.io/package/@types/node.md) ^12.12.8
- [body-parser](https://npm.io/package/body-parser.md) ^1.19.0
- [cookie-session](https://npm.io/package/cookie-session.md) ^1.3.3
- [passport-auth0](https://npm.io/package/passport-auth0.md) ^1.2.1
- [passport-local](https://npm.io/package/passport-local.md) ^1.0.0
- [@reshuffle/auth](https://npm.io/package/@reshuffle/auth.md) 0.0.1

## 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.0 (latest) — 2019-12-01
- 0.1.3 — 2019-11-24
- 0.1.2 — 2019-11-20
- 0.1.1 — 2019-11-20
- 0.1.0 — 2019-11-20
- 0.0.5 — 2019-11-20
- 0.0.4 — 2019-11-19
- 0.0.3 — 2019-11-19
- 0.0.2 — 2019-11-18

## README

## `@reshuffle/passport`

"out-of-the-box" auth for your app.

Meant to be paired with [`@reshuffle/react-auth`](../react-auth).

See a fully working demo [here](https://github.com/reshufflehq/auth-template).

### Installation
```console
$ npm install @reshuffle/passport
```

### Usage
Configure `backend/_handler.js`

```js
const app = express();
app.use('/', authRouter());

// Custom routes go here

app.use(defaultHandler);

export default app;
```

Add custom routes

```js
app.get('/display-name', (req, res) => {
  if (!req.user) {
    return res.sendStatus(403);
  }
  res.end(req.user.displayName);
});
```

Access user from your `@expose`d functions

`backend/todos.js`
```js
import { getCurrentUser } from '@reshuffle/server-function';
import { get } from '@reshuffle/db';

/* @expose */
export async function getTodos() {
  const user = getCurrentUser(true /* required - will throw an error if not authenticated */);
  return get(`/todos/${user.id}`);
});
```

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