All Projects → rkusa → Koa Passport

rkusa / Koa Passport

Licence: mit
Passport middleware for Koa

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Koa Passport

Vue Koa Demo
🔰A simple full stack demo(CSR & SSR & Docker Support) written by Vue2 & Koa2(Koa1 verson also completed)
Stars: ✭ 730 (-2.41%)
Mutual labels:  koa, koa2
Node Typescript Koa Rest
REST API boilerplate using NodeJS and KOA2, typescript. Logging and JWT as middlewares. TypeORM with class-validator, SQL CRUD. Docker included. Swagger docs, actions CI and valuable README
Stars: ✭ 739 (-1.2%)
Mutual labels:  koa, koa2
Koahub
KoaHub.js -- 中文最佳实践Node.js Web快速开发框架。支持Koa.js, Express.js中间件。当前项目已停止维护,推荐使用Doodoo.js
Stars: ✭ 308 (-58.82%)
Mutual labels:  koa, koa2
react-isomorphic-bundle
React Redux Universal (isomorphic) bundle
Stars: ✭ 53 (-92.91%)
Mutual labels:  koa, passport
Koa2 Note
《Koa2进阶学习笔记》已完结🎄🎄🎄
Stars: ✭ 4,725 (+531.68%)
Mutual labels:  koa, koa2
koa-router-version
Semantic Versioning routing for Koa
Stars: ✭ 19 (-97.46%)
Mutual labels:  koa, koa2
Egg
🥚 Born to build better enterprise frameworks and apps with Node.js & Koa
Stars: ✭ 17,616 (+2255.08%)
Mutual labels:  koa, koa2
restria
Entria's REST API boilerplate
Stars: ✭ 25 (-96.66%)
Mutual labels:  koa, koa2
Koa2 Api Scaffold
一个基于Koa2的轻量级RESTful API Server脚手架。
Stars: ✭ 694 (-7.22%)
Mutual labels:  koa, koa2
Koa Rest Api Boilerplate
💯 Boilerplate for Node.js Koa RESTful API application with Docker, Swagger, Jest, CodeCov and CircleCI
Stars: ✭ 420 (-43.85%)
Mutual labels:  koa, koa2
polix
🚀 Node.js Web Framework
Stars: ✭ 32 (-95.72%)
Mutual labels:  koa, koa2
Koajs Design Note
《Koa.js 设计模式-学习笔记》已完结 😆
Stars: ✭ 520 (-30.48%)
Mutual labels:  koa, koa2
Agile-Server
A simple, fast, complete Node.js server solution, based on KOA. 简单快速的 、性能强劲的、功能齐全的 node 服务器解决方案合集,基于 KOA。
Stars: ✭ 24 (-96.79%)
Mutual labels:  koa, koa2
koa2-winston
koa2 version winston logger like express-winston
Stars: ✭ 37 (-95.05%)
Mutual labels:  koa, koa2
koa2-rest-scaffold
Koa2 RESTful API 脚手架。
Stars: ✭ 27 (-96.39%)
Mutual labels:  koa, koa2
Grant
OAuth Proxy
Stars: ✭ 3,509 (+369.12%)
Mutual labels:  koa, authentication
express-to-koa
Use express middlewares in Koa2, the one that really works.
Stars: ✭ 18 (-97.59%)
Mutual labels:  koa, koa2
inversify-koa-utils
inversify-koa-utils is a module based on inversify-express-utils. This module has utilities for koa 2 applications development using decorators and IoC Dependency Injection (with inversify)
Stars: ✭ 27 (-96.39%)
Mutual labels:  koa, koa2
Awesome Koa
👯 Awesome Koa.js Web Framework
Stars: ✭ 343 (-54.14%)
Mutual labels:  koa, koa2
Passport Magic Login
Passwordless authentication with magic links for Passport.js.
Stars: ✭ 493 (-34.09%)
Mutual labels:  authentication, passport

koa-passport

Passport middleware for Koa

NPM Dependency Status Build Status

koa-passport version koa version branch
1.x 1.x v1.x
2.x 2.x v2.x
4.x 2.x master

Migration to v3

  • change ctx.passport.* to ctx.state.* (e.g. ctx.passport.user to ctx.state.user)
  • don't call passport methods on ctx.req (e.g. use ctx.login instead of ctx.req.login)
  • update custom authentication callback arguments to err, user, info, status (e.g. passport.authenticate('local', function(err, user, info, status) { ... })(ctx, next))

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

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].