# easy-express-auth0

> ## Installation ``` npm install easy-express-auth0 ```

Latest version **1.0.1** (published 2019-09-07) · ISC license · 0 weekly downloads

## Install

```sh
npm install easy-express-auth0
pnpm add easy-express-auth0
yarn add easy-express-auth0
bun add easy-express-auth0
```

## 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.1 |
| Published | 2019-09-07 |
| First published | 2019-09-07 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 10.2 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| Maintainers | ben-cloud9 |

## Links

- npm: https://www.npmjs.com/package/easy-express-auth0
- npm.io page: https://npm.io/package/easy-express-auth0

## Dependencies (3)

- [express](https://npm.io/package/express.md) ^4.17.1
- [passport](https://npm.io/package/passport.md) ^0.4.0
- [passport-auth0](https://npm.io/package/passport-auth0.md) ^1.2.1

## Recent versions

- 1.0.1 (latest) — 2019-09-07
- 1.0.0 — 2019-09-07

## README

# easy-express-auth0

## Installation
```
npm install easy-express-auth0
```

## Required Environment Variables
```
AUTH0_CLIENT_ID=YOUR_CLIENT_ID
AUTH0_DOMAIN=YOUR_AUTH0_DOMAIN
AUTH0_CLIENT_SECRET=YOUR_CLIENT_SECRET
AUTH0_CALLBACK_URL=YOUR_CALLBACK_URL (your domain + /callback)

```
## Example Server
```
const express = require('express');
const session = require('express-session');
const authentication = require('easy-express-auth0');

const app = express();

// You will need some sort of session provider for this to work
app.use(session({
    secret: 'keyboard cat',
    resave: false,
    saveUninitialized: true,
    cookie: { secure: false }
}));

// call authentiction set up after session set up
const unsecuredRoutes = ['/api/ping', '/', '/manifest.json', '/denied', '/static/**', 'favicon.ico', '/img/**'];
authentication(app, unsecuredRoutes);

app.get('/ping', (req, res) => {
    res.send('pong');
});

app.get('/home', (req, res) => {
    res.send(`home - ${req.user.username}`);
});

app.get('*', (req, res) => {
    res.send('any');
});

app.listen(3000, () => {
    console.log('Server listening on port 3000');
});
```

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