[ICO]NameLast modifiedSizeDescription
[PARENTDIR]Parent Directory  -  
[DIR]lib/2023-06-15 18:18 -  
[   ]package.json2023-06-15 18:21 1.7K 
[TXT]README.md1985-10-26 08:15 1.4Kd7c1522 post receive test [كارل مبارك]
[   ]LICENSE1985-10-26 08:15 1.1K 
[TXT]CHANGELOG.md1985-10-26 08:15 3.3K 
# koa-passport

[Passport](https://github.com/jaredhanson/passport) middleware for Koa

[![NPM][npm]](https://npmjs.org/package/koa-passport)
[![Dependency Status][dependencies]](https://david-dm.org/rkusa/koa-passport)
[![Build Status][travis]](https://travis-ci.org/rkusa/koa-passport)

koa-passport version  | passport version | koa version | branch
--------------------- | ---------------- | ------------| ------
5.x                   | 6.x, 5.x         | 2.x         | main
4.x                   | 4.x              | 2.x         | v3.x
3.x, 2.x              | 2.x              | 2.x         | v2.x
1.x                   | 1.x              | 1.x         | v1.x

## Usage

```js
// body parser
const bodyParser = require('koa-bodyparser')
app.use(bodyParser())

// Sessions
const session = require('koa-session')
app.keys = ['secret']
app.use(session({}, app))

const passport = require('koa-passport')
app.use(passport.initialize())
app.use(passport.session())
```

[Example Application](https://github.com/rkusa/koa-passport-example)

Passport's values and methods are exposed as follows:

```js
app.use(async ctx => {
  ctx.isAuthenticated()
  ctx.isUnauthenticated()
  await ctx.login()
  ctx.logout()
  ctx.state.user
})
```

## License

  [MIT](LICENSE)

[npm]: http://img.shields.io/npm/v/koa-passport.svg
[dependencies]: http://img.shields.io/david/rkusa/koa-passport.svg
[travis]: https://travis-ci.org/rkusa/koa-passport.svg?branch=master