Socket
Socket
Sign inDemoInstall

koa-passport

Package Overview
Dependencies
4
Maintainers
1
Versions
41
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    koa-passport

Passport middleware for Koa


Version published
Weekly downloads
153K
decreased by-12.36%
Maintainers
1
Install size
107 kB
Created
Weekly downloads
 

Changelog

Source

6.0.0

Potentially breaking change:

  • change logout signature from (options, callback) => void to (options) => Promise<void> #188

Readme

Source

koa-passport

Passport middleware for Koa

NPM

koa-passport versionpassport versionkoa versionbranch
6.x, 5.x6.x, 5.x2.xmain
4.x4.x2.xv3.x
3.x, 2.x2.x2.xv2.x
1.x1.x1.xv1.x

Usage

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

Passport's values and methods are exposed as follows:

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

License

MIT

Keywords

FAQs

Last updated on 06 Feb 2023

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc