# redis-rememberme

> Redis remember me middleware for connect

Latest version **0.2.1** (published 2013-04-15) · 0 weekly downloads

## Install

```sh
npm install redis-rememberme
pnpm add redis-rememberme
yarn add redis-rememberme
bun add redis-rememberme
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.2.1 |
| Published | 2013-04-15 |
| First published | 2012-11-26 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Node | * |
| Dependencies | 5 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | James Sharp |
| Maintainers | jamessharp |

## Links

- npm: https://www.npmjs.com/package/redis-rememberme
- Repository: https://github.com/jamessharp/redis-rememberme
- npm.io page: https://npm.io/package/redis-rememberme

## Dependencies (5)

- [debug](https://npm.io/package/debug.md) *
- [redis](https://npm.io/package/redis.md) 0.7.x
- [connect](https://npm.io/package/connect.md) 2.x
- [winston](https://npm.io/package/winston.md) *
- [cookie-signature](https://npm.io/package/cookie-signature.md) *

## Recent versions

- 0.2.1 (latest) — 2013-04-15
- 0.2.0 — 2012-12-04
- 0.1.0 — 2012-11-27
- 0.0.1 — 2012-11-26

## README

# Redis Rememberme

This is connect middleware creating remember me functionality to sit alongside [connect_redis](https://github.com/visionmedia/connect-redis). It uses the remember me method [described here ](http://jaspan.com/improved_persistent_login_cookie_best_practice) and detects whether the cookie has been stolen or not.

## Installation
    $ npm install redis-rememberme

You will also need to have connect-redis installed and configured (this piggy backs of its client connection)

## Options
Are almost the same as the connect session middleware with the added `redisStore`

    - `key` cookie name defaulting to connect.sid
    - `redisStore` connect-redis instance
    - `secret` session cookie is signed with this secret to prevent tampering
    - `cookie` session cookie settings, defaulting to { path: '/', httpOnly: true, maxAge: null }
    - `proxy` trust the reverse proxy when setting secure cookies (via "x-forwarded-proto")

## Usage (with an express app)

    var RedisStore = require('connect-redis')(express)
      , RememberMe = require('redis-rememberme');

    // Do some setup for the RedisStore to give you redisStore
    var rememberMeSettings = {
        cookie: {
          maxAge: 24*3600*1000 * 30 // 30 Days in ms
        },
        secret: 'secret,
        redisStore: redisStore,
        key: 'cookie-name'
    };
    app.use(new RememberMe(rememberMeSettings));

This will create some extra properties on the req and res object. To destroy the rememberme session simply call `req.rememberme.destroy()`. To check whether a cookie has been stolen test `req.rememberme.stolen`. To set a remember me cookie for a user simply add `res.rememberme = {userid: '1234'}` or whatever in your routes.

You can also listen to `rememberMe.worker` for the `cleanup` and `cleaned` events to determine when cleanup is about to and has happened.

For more details have a look at the tests...

## Licence
MIT

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