Coder Social home page Coder Social logo

koa-passport's Introduction

koa-passport

Passport middleware for Koa

NPM

koa-passport version passport version koa version branch
6.x, 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

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

koa-passport's People

Contributors

aghost-7 avatar cayasso avatar chentsulin avatar cr1s avatar dependabot-preview[bot] avatar dizlexik avatar fundon avatar gingerich avatar greenkeeperio-bot avatar iliakan avatar jiangjie avatar jpetitcolas avatar kherock avatar kudos avatar lehni avatar pesho avatar rkusa avatar roymiloh avatar tigerc10 avatar tommoor avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

koa-passport's Issues

Cannot get next tag from npm

DAVIDs-iMac:eatYourFriends2017 dave$ npm install koa-passport@next --verbose
npm info it worked if it ends with ok
npm verb cli [ '/usr/local/bin/node',
npm verb cli '/usr/local/bin/npm',
npm verb cli 'install',
npm verb cli 'koa-passport@next',
npm verb cli '--verbose' ]
npm info using [email protected]
npm info using [email protected]
npm verb request uri https://registry.npmjs.org/koa-passport
npm verb request no auth needed
npm info attempt registry request try #1 at 10:48:47 AM
npm verb request id 97b017e43a216619
npm verb etag "AKM6RWDK5HFO11UKSSGV64Q3C"
npm http request GET https://registry.npmjs.org/koa-passport
npm http 304 https://registry.npmjs.org/koa-passport
npm verb headers { date: 'Fri, 01 Jul 2016 17:48:47 GMT',
npm verb headers via: '1.1 varnish',
npm verb headers 'cache-control': 'max-age=300',
npm verb headers etag: '"AKM6RWDK5HFO11UKSSGV64Q3C"',
npm verb headers age: '99',
npm verb headers connection: 'keep-alive',
npm verb headers 'x-served-by': 'cache-lax1437-LAX',
npm verb headers 'x-cache': 'HIT',
npm verb headers 'x-cache-hits': '1',
npm verb headers 'x-timer': 'S1467395327.705426,VS0,VE0',
npm verb headers vary: 'Accept-Encoding' }
npm verb etag https://registry.npmjs.org/koa-passport from cache
npm verb get saving koa-passport to /Users/dave/.npm/registry.npmjs.org/koa-passport/.cache.json
npm verb correctMkdir /Users/dave/.npm correctMkdir not in flight; initializing
npm verb cache add spec koa-passport@next
npm verb addNamed "next" is being treated as a dist-tag for koa-passport
npm info addNameTag [ 'koa-passport', 'next' ]
npm verb addNameTag registry:https://registry.npmjs.org/koa-passport not in flight; fetching
npm verb get https://registry.npmjs.org/koa-passport not expired, no request
npm verb addNamed "2.1.1" is a plain semver version for koa-passport
npm verb afterAdd /Users/dave/.npm/koa-passport/2.1.1/package/package.json not in flight; writing
npm verb correctMkdir /Users/dave/.npm correctMkdir not in flight; initializing
npm verb afterAdd /Users/dave/.npm/koa-passport/2.1.1/package/package.json written
npm verb request uri https://registry.npmjs.org/passport
npm verb request no auth needed
npm info attempt registry request try #1 at 10:48:48 AM
npm verb etag "536JQUIE2ZILIC75GIQCVNSZT"
npm http request GET https://registry.npmjs.org/passport
npm http 304 https://registry.npmjs.org/passport
npm verb headers { date: 'Fri, 01 Jul 2016 17:48:48 GMT',
npm verb headers via: '1.1 varnish',
npm verb headers 'cache-control': 'max-age=300',
npm verb headers etag: '"536JQUIE2ZILIC75GIQCVNSZT"',
npm verb headers age: '257',
npm verb headers connection: 'keep-alive',
npm verb headers 'x-served-by': 'cache-lax1437-LAX',
npm verb headers 'x-cache': 'HIT',
npm verb headers 'x-cache-hits': '2',
npm verb headers 'x-timer': 'S1467395328.936120,VS0,VE0',
npm verb headers vary: 'Accept-Encoding' }
npm verb etag https://registry.npmjs.org/passport from cache
npm verb get saving passport to /Users/dave/.npm/registry.npmjs.org/passport/.cache.json
npm verb correctMkdir /Users/dave/.npm correctMkdir not in flight; initializing
npm verb cache add spec passport@^0.3.0
npm verb addNamed ">=0.3.0 <0.4.0" is a valid semver range for passport
npm verb addNameRange registry:https://registry.npmjs.org/passport not in flight; fetching
npm verb get https://registry.npmjs.org/passport not expired, no request
npm verb addNamed "0.3.2" is a plain semver version for passport
npm verb afterAdd /Users/dave/.npm/passport/0.3.2/package/package.json not in flight; writing
npm verb correctMkdir /Users/dave/.npm correctMkdir not in flight; initializing
npm verb afterAdd /Users/dave/.npm/passport/0.3.2/package/package.json written
npm verb request uri https://registry.npmjs.org/pause
npm verb request no auth needed
npm info attempt registry request try #1 at 10:48:48 AM
npm verb etag "AMXJRF8IYEDH2W7ZVFJ83MJR8"
npm http request GET https://registry.npmjs.org/pause
npm http 304 https://registry.npmjs.org/pause
npm verb headers { date: 'Fri, 01 Jul 2016 17:48:49 GMT',
npm verb headers via: '1.1 varnish',
npm verb headers 'cache-control': 'max-age=300',
npm verb headers etag: '"AMXJRF8IYEDH2W7ZVFJ83MJR8"',
npm verb headers age: '298',
npm verb headers connection: 'keep-alive',
npm verb headers 'x-served-by': 'cache-lax1437-LAX',
npm verb headers 'x-cache': 'HIT',
npm verb headers 'x-cache-hits': '3',
npm verb headers 'x-timer': 'S1467395329.020608,VS0,VE0',
npm verb headers vary: 'Accept-Encoding' }
npm verb etag https://registry.npmjs.org/pause from cache
npm verb get saving pause to /Users/dave/.npm/registry.npmjs.org/pause/.cache.json
npm verb correctMkdir /Users/dave/.npm correctMkdir not in flight; initializing
npm verb cache add spec [email protected]
npm verb addNamed "0.0.1" is a plain semver version for pause
npm verb addNameVersion registry:https://registry.npmjs.org/pause not in flight; fetching
npm verb get https://registry.npmjs.org/pause not expired, no request
npm verb afterAdd /Users/dave/.npm/pause/0.0.1/package/package.json not in flight; writing
npm verb correctMkdir /Users/dave/.npm correctMkdir not in flight; initializing
npm verb afterAdd /Users/dave/.npm/pause/0.0.1/package/package.json written
npm verb correctMkdir /Users/dave/.npm/_locks correctMkdir not in flight; initializing
npm verb lock using /Users/dave/.npm/_locks/staging-d0ae6657fa36e412.lock for /Users/dave/Documents/repos/eatYourFriends2017/node_modules/.staging
npm verb unbuild node_modules/.staging/koa-passport-2440a681
npm verb gentlyRm don't care about contents; nuking /Users/dave/Documents/repos/eatYourFriends2017/node_modules/.staging/koa-passport-2440a681
npm verb tar unpack /Users/dave/.npm/koa-passport/2.1.1/package.tgz
npm verb tar unpacking to /Users/dave/Documents/repos/eatYourFriends2017/node_modules/.staging/koa-passport-2440a681
npm verb gentlyRm don't care about contents; nuking /Users/dave/Documents/repos/eatYourFriends2017/node_modules/.staging/koa-passport-2440a681
npm verb gentlyRm don't care about contents; nuking /Users/dave/Documents/repos/eatYourFriends2017/node_modules/.staging/koa-passport-2440a681/node_modules
npm info lifecycle [email protected]preinstall: [email protected]
npm info linkStuff [email protected]
npm verb linkBins [email protected]
npm verb linkMans [email protected]
npm info lifecycle [email protected]
install: [email protected]
npm info lifecycle [email protected]~postinstall: [email protected]
npm verb unlock done using /Users/dave/.npm/_locks/staging-d0ae6657fa36e412.lock for /Users/dave/Documents/repos/eatYourFriends2017/node_modules/.staging
[email protected] /Users/dave/Documents/repos/eatYourFriends2017
`-- [email protected] invalid

support for latest koa

Hi ,
I guess in the newer version of koa, this.req has been replaced by this.request. I am using using your module in my project but I want to upgrade but its making me harder to manage both. Can you please upgrade the module or just pass me some hints so I can do it and push t for you. Thanks

latest is 2.x

Hello. I think you mistakenly published v2.2.0 as latest on npm:

npm info koa-passport dist-tags
{ latest: '2.2.0', next: '2.2.0' }

adhere to updated koa v2 repo / version approach

  • create a branch v2.x from master.
  • force update master to v1.x
  • change latest tag in npm point to koa-passport@1
  • add a next tag point to koa-passport@2, people can install koa-passport@2 by npm install koa-passport@next

Unable to check if the user is authenticated.

Hi,
i tried to use the local strategy but with no luck. I keep getting ctx.isAuthenticated()===false in the authMiddlweare.

Here is my configuration:

function* authMiddlweare( next ) {
  debug( 'authMiddlweare' );

  if( this.isAuthenticated() ) { // ALWAYS FALSE HERE
    yield next;
  } else {
    var loginUrl = config.routes.publicArea.url( 'login' );
    this.redirect( loginUrl );
  }
}

passport.serializeUser( function( user, done ) {
  debug( 'Serializing %s(%s)', user.username, user.id );
  return done( null, user.id );
} );
passport.deserializeUser( function( id, done ) {
  debug( 'Deserializing (%s)', id );

  var User = config.models.user;

  User
  .findById( id )
  .execAsync()
  .then( function( user ) {
    if( !user )
      throw new Error( 'Unable to find the user for deserialization.' );

    return done( null, user );
  } )
  .catch( done );
} );

var strategyOptions = {
  failureRedirect: '/login'
};

var localStrategy = new LocalStrategy( function localStrategyCallback( username, password, done ) {
  debug( 'Local strategy check' );

  var User = config.models.user;

  User
  .findByUsername( username )
  .then( function( user ) {

    if( !user )
     throw new Error( 'No user with "'+username+'" found!' );

    debug( 'User %s(%s) found', user.username, user.id );

    if( !user.isPasswordValid( password ) )
     throw new Error( 'Invalid credentials!' );

    return done( null, user );
  } )
  .catch( done );
} );

passport.use( localStrategy );

`this.req.user` undefined

Everything worked well last Monday. Now, after a module update, everything broke as this.req.user is undefined. I'm not sure if this is related to "this" particular module, but I'm creating this issue for cross reference, if anything.

I'm not too sure how to reproduce this as the application I'm working on is highly customized with complex initializations and relies on plugins, and a few middlewares.

ctx.req.user being called by a dependency

Issue will be tracked here

@jeffijoe in #57

It appears that the verify callback in strategies use the req setter. E.g. https://github.com/jaredhanson/passport-http/blob/master/lib/passport-http/strategies/basic.js#L95

I checked the stack trace:

at IncomingMessage.Object.defineProperty.set [as user] (\node_modules\koa-passport\lib\framework\koa.js:37:19)
at Object.properties.(anonymous function).set (\node_modules\koa-passport\lib\framework\request.js:113:16)
at Object.req.login.req.logIn (\node_modules\passport\lib\http\request.js:44:18)
at Object.<anonymous> (\node_modules\koa-passport\lib\framework\request.js:104:27)
at BasicStrategy.strategy.success (\node_modules\passport\lib\middleware\authenticate.js:235:13)
at verified (\node_modules\passport-http\lib\passport-http\strategies\basic.js:91:10)

So this deprecation notice is unavoidable it seems.

Should I open a new issue?

@mapmeld in rkusa/koa-passport-example#20

With the latest update to koa-passport, I get a koa-passport deprecated setting ctx.req.user is deprecated in favour of ctx.state.user warning when I log in

This codebase doesn't use ctx.req or ctx.state, so my best guess is that it's coming from koa-route or another dependency.

username and password parameters

edit: reading comprehension issues: should have read example again. Can close

I noticed you are using the node req/res objects here:

var res = yield auth.bind(auth, this.req, this.res)

How is this working with the passport local strategy? The req.query and req.body parameters aren't defined normally (this.req.query) but this.request.query should be defined. The passport local strategy checks in Strategy.prototype.authenticate = function(req, options)

Strategy.prototype.authenticate = function(req, options) {
  options = options || {};
  var username = lookup(req.body, this._usernameField) || lookup(req.query, this._usernameField);
  var password = lookup(req.body, this._passwordField) || lookup(req.query, this._passwordField);

Getting 404 Issue when trying to access my route

My auth.js

const router = require('koa-router')(),
      passport = require('koa-passport'),
      Strategy = require('passport-facebook').Strategy;

passport.serializeUser(function(user, cb) {
  cb(null, user);
});

passport.deserializeUser(function(obj, cb) {
  cb(null, obj);
});

passport.use(new Strategy({
  clientID: process.env.CLIENT_ID,
  clientSecret: process.env.CLIENT_SECRET,
  callbackURL: 'http://localhost:3000/auth/return'
}, function(token, tokenSecret, profile, done) {
  console.log("ACCESS TOKEN: ", accessToken);
  console.log("REFRESH TOKEN: ", refreshToken);
  console.log("PROFILE : ", profile);
  return cb(null, profile);
}));


router.get('/login', passport.authenticate('facebook'));

router.get('/return', passport.authenticate('facebook', { failureRedirect: '/' }), async function returnCallback(ctx, next) {
  await ctx.redirect("/");
});


module.exports = router;

My app.js

const Koa = require('koa');
const app = new Koa();
const router = require('koa-router')();
const views = require('koa-views');
const co = require('co');
const convert = require('koa-convert');
const json = require('koa-json');
const onerror = require('koa-onerror');
const bodyparser = require('koa-bodyparser')();
const logger = require('koa-logger');
const session = require('koa-session');
const passport = require('koa-passport');

const home = require('./routes/home');
const auth = require('./routes/auth');

// middlewares
app.keys = ['pgn4qn4np89qgn9p4n9p4qn98pq4n98pqn9438n98g34n98q3n9q3g94'];
app.use(convert(bodyparser));
app.use(convert(json()));
app.use(convert(session(app)));
app.use(passport.initialize());
app.use(passport.session());
app.use(convert(logger()));
app.use(require('koa-static')(__dirname + '/public'));

app.use(views(__dirname + '/views', {
  extension: 'ejs'
}));

// logger
app.use(async (ctx, next) => {
  const start = new Date();
  await next();
  const ms = new Date() - start;
  console.log(`${ctx.method} ${ctx.url} - ${ms}ms`);
});

router.use('/', home.routes(), home.allowedMethods());
router.use('/auth', auth.routes(), auth.allowedMethods());

app.use(router.routes(), router.allowedMethods());
// response

app.on('error', function(err, ctx){
  console.log(err)
  logger.error('server error', err, ctx);
});


module.exports = app;

But when I go to http://localhost:3000/auth/login I just get a 404 error, but if I remove the passport.authenticate() and put in a view render instead the route works just fine, so for some reason the passport-authenticate is giving me a 404 error. Thanks.

Not generating oauth_token

I have a strange problem, and I'm not even entirely sure it's with koa-passport, but I don't know where else to turn.

The code I'm using is pretty much exactly the code in the example, and up until recently, everything was working correctly. I tried setting up a new machine to run my project, and I'm finding that on any new machine I try to set up, I can't get my app to send back an oauth_token.

I'm using the passport-twitter strategy only, and when I do a GET on http://127.0.0.1:3000/auth/twitter on one of my working computers, it responds back with:

api.twitter.com/oauth/authenticate?oauth_token=XXX

where XXX is the oauth_token. When I do the same request on a non-working computer (same code, same everything else from what I can tell), I get:

api.twitter.com/oauth/authenticate

which obviously doesn't work. I've tried everything I can think of to make this work and I'm absolutely stumped. Any thoughts?

is it possible to use koa-passport without session?

Hello, just building a restful api for an ios application, i was trying to use json web token to authenticate all my api end points...

ended up hitting a snag

// callback version
passport.use(new LocalStrategy({session: false},
  function(username, password, done) {
    pool.getConnection(function(connectionError, connection) {
      console.log('connection error', connectionError);
      const q = {};
      q.sql = 'SELECT ?? FROM ?? WHERE ?? = ?';
      q.values = ['userPwHash', 'user', 'userName', username];
      connection.query(q, function(err, rows) {
        console.log('query error', err);
        console.log('rows', rows);
        if (err) {return done(err); }
        if (!rows.length) {
          return done(null, false, {message: 'Incorrect username.'});
        }
        const dbpwhash = rows[0].userPwHash;
        bcrypt.compare(password, dbpwhash, function(hashError, match) {
          console.log('hasherror', hashError);
          if (match) { return done(null, {userName: username}); }
          if (!match) {return done(null, false, {message: 'Incorrect password.'}); }
        });
        connection.close();
      });
      // pool.end();
    });
  }
));
Error: Failed to serialize user into session

i was wondering if session is required or how i would go about using an auth token for authentication. thanks again!

Does not work with koa-better-body

What is the trick to making this work with koa-better-body? The local strategy is never called.

Also, it would be nice if the documentation mentioned that the form fields for local MUST be called username and password or it simply won't work. That missing info cost me several hours of frustration, and I doubt that I'm the only one to have to deal with that.

The problem with the mock

  1. There's a need for req, connection property addressed by PR #18
  2. There's a need to keep other properties bound to req when passed by passport. Maybe a foreach loop or an additional configuration will do.

The use case: I have req.log method which logs with request information (so I know the context). I also use passReqToCallback: true in strategies to have the req object (to log it and to merge profiles).

With the new koa-passport, req.log is undefined, so the project dies.

Requesting example for handling data after serialization & routing

I am having a hard time figuring out how to access the user data after authentication.

    // below the console.log(next) just outputs {}, en empty json string. this.isAuthenticated() is working.
    .get('/', function* (next) {
        console.log(next);
        if (this.isAuthenticated()) {
            yield this.render('homeSecure', {user?}); // example how to put the user data from the strategy here
        } else {
            yield this.render('homePublic', {});
        }
    })

// below when logging in and callback
.get('/google',
        passport.authenticate('google', {
            scope: ['https://www.googleapis.com/auth/plus.login', 'https://www.googleapis.com/auth/userinfo.email']
        }))
    .get('/google/callback',
        passport.authenticate('google', {
            successRedirect: '/',
            failureRedirect: '/'
        }));

Uising koa-router for routing.

Update dependencies

Can the deps be updated? I just figure that creating a fork and a PR just for that is dumb and anyone with access to origin:master could be able to do that in under a minute easily.

authorize functionality does not appear to work

When invoking passport.authorize, this.req.account is never set to the account from the strategy you are linking from. For example:

const app = koa()
app.use(compose([passport.authenticate('local'), passport.authorize('facebook'), function *() {
  console.log(this.req.user) // this prints the local user as expected
  console.log(this.req.account) // this does not print the facebook account
}]))

authorize is used to link an existing authenticated account (in this case, 'local') with another provider. By default, according to passport docs, the newly linked account is placed in req.account in Express; the corresponding place for this would be this.req.account in koa.

"OAuthStrategy requires a verify callback"

on line 7 im supposedly not defining a callback.. I'm not sure if the issue is with my syntax, koa-convert or koa-passport - can you see any problems with it ?

OAuthStrategy requires a verify callback
import Strategy from 'passport-twitter';
import passport from 'koa-passport';
import Koa from 'koa';
let app = new Koa();

import convert from 'koa-convert';
app.use(convert(Strategy()))

export function initTwitterStrategy(){
var user = { id: 1, username: 'test' }
passport.serializeUser(function(user, done) {
  done(null, user.id)
})
passport.deserializeUser(function(id, done) {
  done(null, user)
})
passport.use(new Strategy({
    consumerKey: 'sYwaHTFjXet63oaeUlPSUic9',
    consumerSecret: 'Ka9Ds05LPtWqRrpO8SFPf8f7zJwROMasgN6ixzAhlPBKSl7kV',
    callbackURL: 'http://127.0.0.1:3000/auth/twitter/callback'
  },
  async (token, tokenSecret, profile, done) => {
    console.log("THIS HAPPENS?");
    await done(profile)
  }
))
}

passport facebook route 404 error

Versions

"koa-passport": "^1.3.0"
"koa-router": "^5.4.0"
NodeJS 6.1.0

I get 404 error when use koa-passport and koa-router in my app
my route file

const Router = require('koa-router');
const passport = require('koa-passport');

function register (app) {
    const router = new Router({
        prefix: '/auth'
    });
    router.get('/facebook', function* () {
        passport.authenticate('facebook');
    });
    app.use(router.routes());
    app.use(router.allowedMethods());
}

module.exports = register;

app.js

app.use(passport.initialize());
app.use(passport.session());
//....
require('./app/server/routes/auth.route')(app);

When I go to the '/auth/facebook' route I get 'Page not Found' error.
If I comment passport.authenticate('facebook'); line route works fine with something like this.body = 'facebook login';

Thanks

Example of custom callback

Any chance I could get an example of using a custom callback with passport.authenticate? Trying to create the equiv to the example found here: http://passportjs.org/guide/authenticate/

As far as my use case goes, I'm looking to reply back with JSON on failure and not perform a redirect/session manipulation.

Thanks!

Flash message

Hi. I try use flash message:
router.post('/user/auth/', passport.authenticate('local', { successRedirect: '/', failureRedirect: '/user/login/', failureFlash: true }));
In local strategy:
done(null, false, { message: 'Incorrect username or password' });
i get error:

events.js:160
      throw er; // Unhandled 'error' event
      ^

TypeError: req.flash is not a function
    at allFailed (/home/artem/projects/website/files/node_modules/passport/lib/middleware/authenticate.js:118:15)
    at attempt (/home/artem/projects/website/files/node_modules/passport/lib/middleware/authenticate.js:167:28)
    at Strategy.strategy.fail (/home/artem/projects/website/files/node_modules/passport/lib/middleware/authenticate.js:284:9)
    at verified (/home/artem/projects/website/files/node_modules/passport-local/lib/strategy.js:82:30)
    at /home/artem/projects/website/files/modules/auth/index.js:22:6
    at Query.<anonymous> (/home/artem/projects/website/files/node_modules/mongoose/lib/model.js:3352:16)
    at /home/artem/projects/website/files/node_modules/kareem/index.js:244:21
    at /home/artem/projects/website/files/node_modules/kareem/index.js:127:16
    at _combinedTickCallback (internal/process/next_tick.js:67:7)
    at process._tickCallback (internal/process/next_tick.js:98:9)

How to fix this error?

koa-passport breaks node-inspector (remove Proxy)

Thanks for the great module.

Kind of cool that it uses ES6 Proxy, but that's too early. Right now ES6 Proxy are non-debuggable, see the discussion here node-inspector/node-inspector#413.

Koa-passport is usually quite close to the top of the execution stream. When node-inspector meets proxy, it dies, effectively making all the application code below undebuggable.

(That's actually a suggestion, I don't have a stack, but koa-passport is the only module which uses ES6 proxy in the project, and node-inspector dies with that Proxy Illegal access error).

Given that the ES6 Proxy debugging issue is not going to be fixed soon, could you please remove it from the code and replace with something more-or-less stable please?

Login

Passport has a login method: http://passportjs.org/guide/login/

How do I use that with koa-passport?

The following fails:

        var user = yield User.getForSession(userId);

        yield this.login(user);
        this.body = {
            ok: 1
        };

With this error:

TypeError: undefined is not a function
    at /Users/ruben/Projects/Savanne/datahub/node_modules/passport-remember-me/node_modules/passport/lib/passport/http/request.js:46:7
    at Authenticator.passport.serializeUser (/Users/ruben/Projects/Savanne/datahub/src/common/auth.js:28:5)
    at IncomingMessage.req.login.req.logIn (/Users/ruben/Projects/Savanne/datahub/node_modules/passport-remember-me/node_modules/passport/lib/passport/http/request.js:43:29)
    at Object.<anonymous> (/Users/ruben/Projects/Savanne/datahub/src/webui/handlers/activate.js:48:20)
    at GeneratorFunctionPrototype.next (native)
    at Object.next (/Users/ruben/Projects/Savanne/datahub/node_modules/koa/node_modules/co/index.js:83:21)
    at /Users/ruben/Projects/Savanne/datahub/node_modules/koa/node_modules/co/index.js:102:18
    at /Users/ruben/Projects/Savanne/datahub/node_modules/koa/node_modules/co/index.js:222:7
    at tryCatch1 (/Users/ruben/Projects/Savanne/datahub/node_modules/bluebird/js/main/util.js:63:19)
    at Promise$_callHandler [as _callHandler] (/Users/ruben/Projects/Savanne/datahub/node_modules/bluebird/js/main/promise.js:695:13)
    at Promise$_settlePromiseFromHandler [as _settlePromiseFromHandler] (/Users/ruben/Projects/Savanne/datahub/node_modules/bluebird/js/main/promise.js:711:18)
    at Promise$_settlePromiseAt [as _settlePromiseAt] (/Users/ruben/Projects/Savanne/datahub/node_modules/bluebird/js/main/promise.js:868:14)
    at Promise$_settlePromises [as _settlePromises] (/Users/ruben/Projects/Savanne/datahub/node_modules/bluebird/js/main/promise.js:1006:14)
    at Async$_consumeFunctionBuffer [as _consumeFunctionBuffer] (/Users/ruben/Projects/Savanne/datahub/node_modules/bluebird/js/main/async.js:74:12)
    at Async$consumeFunctionBuffer (/Users/ruben/Projects/Savanne/datahub/node_modules/bluebird/js/main/async.js:37:14)
    at process._tickCallback (node.js:343:11)

Which seems to indicate that it's complaining about not having a done function.

req.flash is not a function

When I configure my login route as following:

router.post('/login', passport.authenticate('local', {
    successRedirect: '/user/logout',
    failureRedirect: '/user/login?wrong',
    failureFlash: true
}));

I got a req.flash is not a function error. And indeed, req.flash is undefined.

PS: don't take care about URL, it's just for testing purposes. ;)

Declaration files Typescript

Has anyone worked with Typescript 2? And are there maybe any plans to write declaration files for koa-passport?

Some odd problems with custom strategies

When creating a custom strategy:

app.use(
(ctx, next) =>
  passport.authenticate('local',
  async (err, user, info, status) => {
    if (err) {
      ctx.status = 401;
      return;
    }
    if (user === false) {
      ctx.status = 401;
      return;
    }

    await ctx.login(user, { session: false })
    next()
  }
)(ctx, next),

async (ctx, next) => {
    //ctx.state.user is available here
    //DO SOME ASYNC STUFF (none of these is throwing errors)
    await something;

    ctx.status = 200;
    console.log(ctx.status) //shows 200
}
)

The result from this is a 404 status for some reason.

There's also a separate but possibly related issue of not being able to use ctx.throw inside the (err, user, info, status) function. It ends up also sending a 404 status instead of whatever I'm throwing though this isn't as big of a problem.

Not sure if I am just misunderstanding how to use this, but I simply want to do a custom login, then have a middleware after that does some async stuff and sends some data to client.

arguments being passed are in incorrect order

Hi, I have a login route and inside it I do
return koapassport.authenticate('local', function(err, user, info, status) {
when I log out the args ( on what should be a successful login ), user, info and status are all null, and err is equal to my user object.
I'm defining my local strategy just like in the examples. Not sure quite what's going on.
I've read through the source code for koa-passport and local-passport and don't see what's happening. I guess the next step for me is to dig into passport source call, because if I"m not mistaken you are internally handing the call back to the passport.authenticate method, so perhaps something has chnaged in there.
I'm using koa-passport 2.2.2
Thanks,
Raif

Koa-password and twitter oauth1 integration

Hi,

I am stuck with implementing the basic oauth1 flow for Twitter. I am trying to implement my own handling for authenticate middleware but I don't have access to the context in there:

router.get('/auth/twitter/callback',
  passportAuth.authenticate('twitter', function* (err, user, info, status) {
    if (!err) {
      this.redirect('http://localhost:4200/?id=' + user.id); // this is undefined
      return;
    }

    this.redirect('http://localhost:4200'); // this is undefined
  })
);

How to implement a custom processing of the redirection? Also is it possible to use passport w/o session? I am building a session-less server but it looks like passport for Twitter only works with session.

Thanks in advance.

Cannot return an error in the callback

See this code:

    passport.use(new GoogleStrategy(strategyOpts,
        function(accessToken, refreshToken, profile, done) {
            // Check that the hosted domain is correct
            let profileObj = profile || {}
            let profileArgs = profile._json || {}
            if(!profileArgs || !profileArgs.domain || profileArgs.domain != config.google.hostedDomain) {
                return done('An error', null)
            }

            return done(null, profile)
        })
    )

When passing an error to the done callback (first argument), the page doesn't finish loading.

Does not work with koala

Koala.js is packaged koa.js. When trying to get this to work with Koala.js, I found out that I couldn't authenticate even with correct username and password. (I was using koa-passport-example as a reference). I am not an expert, but I tried to identify the issue.

I rewrote the koa-passport example to use koala instead of koa. It still didn't work. Then I tried to rewrite koa-passport-example to use koa, but instead use the modules that koala uses for specific purposes. I found that I can change everything and it works fine, except when I change it to use koa-body-parsers (which is what koala uses) instead of koa-bodyparser (which is what koa-passport-example is using), it doesn't work.

I think it has something to do with how koa-passport parses the body of of a POST request; that the piece of code used for this doesn't yield a good body when koa-body-parsers is used instead of koa-bodyparser. I found that with koa-body-parsers, I have to do yield* this.request.json() to get the request body, whereas with koa-bodyparser, I can do this.request.body.

Also I'm not sure whether I should be posting this here or over at koala repo, or at body-parsers repo. I'm not even sure if this is a problem caused by some stupid mistake I'm doing, however I've checked and double checked, and koa-passport-example works in every scenario except when using koa-body-parsers module instead of koa-bodyparser.

Passport-oath2 broken check for 'trust proxy'

I'm using passport-facebook which in turn uses passport-oauth2. It looks like there is a line of code explicitly for express buried down in it that causes loggin in to crash.

If you look in the file below the offending line is 19:
https://github.com/jaredhanson/passport-oauth2/blob/master/lib/utils.js

exports.originalURL = function(req, options) {
  options = options || {};
  var app = req.app;
  //this is the bad stuff
  if (app && app.get && app.get('trust proxy')) {
    options.proxy = true;
  }

app.get('header nonsense here') is an express function and doesn't exist for koa. Maybe add a mapping to koa to retrieve the header values according to what express returns?

“err” missing in custom callback arguments

When authenticate is called with a custom callback to override default behavior, the callback expects the four arguments err, user, info and status.

In v2.x/lib/framework/koa.js#L95 the err argument is missing where the original callback is called.

    const _callback = callback
    callback = function(err, user, info, status) {
      if (err) {
        callback.reject(err)
      } else {
        Promise.resolve(_callback(user, info, status)) // should be (err, user, info, status)
               .then(() => callback.resolve(false))
               .catch(err => callback.reject(err))
      }
    }

Just to keep the usage of custom callbacks consistent with how it is described in the official Passport docs.

And just a question on the side: Why isn’t it callback.resolve(… instead of Promise.resolve? reject and resolve are both assigned on line 131–134.

OAuth-based Strategies

Hi @rkusa, thanks for proposing your help.

I'm trying to get koa-passport working with passport-soundcloud.

Here is the code to reproduce my issue : https://gist.github.com/oomathias/273ebe4d7e1ff239590a

The callback is called but nothing happen.
I've tried to place some debug, and it seems stuck at koa-passport/index.js:69
var res = yield auth.bind(auth, this.req, this.res)

Maybe my code is wrong, i'm new to koa.

passport.initialize() middleware not in use

When using koa-passport i get this error :

Error: passport.initialize() middleware not in use
at IncomingMessage.req.login.req.logIn (G:\NAP\node_modules\passport-local\node_modules\passport\lib\passport\http\r
   equest.js:30:30)
at Object.next (G:\NAP\node_modules\koa\node_modules\co\index.js:86:21)
    at Function.<anonymous> (G:\NAP\node_modules\koa\node_modules\co\index.js:89:18)
       at callback (G:\NAP\node_modules\koa-passport\index.js:25:14)
      at Context.delegate.success (G:\NAP\node_modules\koa-passport\node_modules\passport\lib\passport\middleware\authenti
    cate.js:161:18)
     at Context.actions.success (G:\NAP\node_modules\koa-   passport\node_modules\passport\lib\passport\context\http\actions
  .js:21:25)
    at verified (G:\NAP\node_modules\passport-local\lib\passport-    local\strategy.js:83:10)
    at Strategy._verify (G:\NAP\Client\Applications\AutenticationUI\authenticationapp.js:29:13)
     at Strategy.authenticate (G:\NAP\node_modules\passport-local\lib\passport-local\strategy.js:89:10)
   at attempt (G:\NAP\node_modules\koa-passport\node_modules\passport\lib\passport\middleware\authenticate.js:243:16)

and this is my Application

What's wrong

I am extremely sorry but I don't understand what't wrong with my example?
Index file

I need just basic auth want to type test username and test password and redirect to success page

No ctx.state.user on custom login in subsequent middleware

If I do the following:

app.use(route.post('/custom', function(ctx, next) {
  return passport.authenticate('local', async function(user, info, status) {
    if (user === false) {
      ctx.status = 401
      ctx.body = { success: false }
    } else {
      await ctx.login(user)
      next()
    }
  })(ctx, next)
}))

My next middleware shows that ctx.state.user is undefined

koa 2 not handling unsuccessful login

I am confused as to what is the correct way to use koa-passport with koa 2.

So far I have my strategy defined like this:

import Strategy from 'passport-local';

passport.use('local', new Strategy({
  usernameField: 'username',
  passwordField: 'password'
}, async (username, password, done) => {
  try {
    const user = await User.findOne({
      username
    });

    if (!user) {return done(null, false)}

    try {
      const isMatch = await user.validatePassword(password);

      if (!isMatch) {
        return done(null, false)
      }

      done(null, user)
    } catch (err) {
      done(err)
    }

  } catch (err) {
    return done(err)
  }
}))

And I have my auth route defined like this:

const router = new Router();

router.post('/', function(ctx, next) {
  return passport.authenticate('local', function(err, user, info, status) {
    console.dir(arguments.length);
    if(user === false) {
      console.log('it gets here but then........');
      return ctx.throw(401);
    }

    const token = jwt.sign({ id: user.id }, config.token);

    const response = user.toJSON()

    delete response.password;
    delete response.salt;

    ctx.body = {token,user: response};
    ctx.status = 201;
  })(ctx, next)
})
export default router;

This appears to work fine for the successful login but appears to hang and then comes back with this response

Empty reply from server

Help with the right use implementation

I'm trying to use passport with a local login strategy. First I'm doing some simple non passport validation to check the email field (used for login) and password fields are not empty and such.

Then I'm launching a local passport strategy to check the login input against my MongoDB connection.

I can get my passport check to work - I can print the error about a wrong user credentials to the console.log for example - but I don't know how to pass that data back to the koa router.

Here's some sample code to illustrate:


//passport
var passport = require('koa-passport')

// Body parser
app.use(bodyParser())

// Start the router instance
var router = require('koa-router')()
app.use(passport.initialize())

//Require form validation
validateLoginForm = require('./forms/validation')

// Require strategy  
const localLoginStrategy = require('./passport/local-login')
passport.use('local-login', localLoginStrategy)

router.post('/api/login', function* (next){
  this.body = this.request.body
  // Simple validation of the login form
  const validationResult = validateLoginForm(this.body)
  if (!validationResult.success){ 
    yield this.body = {
    success: false,
    message: validationResult.message,
    errors: validationResult.errors
    }
  }
  yield passport.authenticate('local-login', function* (err, token, userData, next) { 
    console.log(err)
    yield {erro:err}
  })
    //I Want to yield my passport check result here so I can do this.body={err}
    }) 

I've tried looking over your example, but it just make me think my implementation might be wrong.

serializeUser and deserializeUser never called

My server.js file looks like this:

import Router from 'koa-router';
import error from './middleware/Error';
import TokenAuth from './middleware/TokenAuth';
import helmet from 'koa-helmet';
import passport from 'koa-passport';
import './config/Passport';
import convert from 'koa-convert';
const session = require('koa-generic-session')

const cors = require('kcors');

const app = new Koa();

app.use(parser({
  onerror: (error, ctx) =>{
    ctx.status = 422
    ctx.body =
      {
        message: "Unable to parse request body."
      }
  }
}));

app.use(cors({
  origin: 'http://localhost:4040'
}));

app.use(helmet());
app.use(logger());
app.use(error());

app.keys = ['the-session-secret'];
app.use(convert(session()));

app.use(passport.initialize());
app.use(passport.session());

const publicRouter = new Router({
  prefix: '/api'
});

publicRouter.use('/managers', managerRoutes.routes());

app.use(publicRouter.routes())
   .use(publicRouter.allowedMethods());

const privateRouter = new Router({
  prefix: '/admin'
});

privateRouter.use(TokenAuth);

privateRouter.use(adminRoutes.routes());

app.use(privateRouter.routes())
   .use(privateRouter.allowedMethods());

const authRouter = new Router({
  prefix: '/auth'
});

authRouter.use(authRoutes.routes());

app.use(authRouter.routes())
   .use(authRouter.allowedMethods());

app.listen(config.site.port);

export default app;

My auth route looks like this:

import jwt from 'jsonwebtoken';
import Router from 'koa-router';
import passport from 'koa-passport';

import { config } from '../config/config';

const router = new Router();

router.post('/', function(ctx, next) {
  return passport.authenticate('local', function(err, user, info, status) {
    if(user === false) {
      ctx.status = 401
      ctx.body = {error: 'Invalid Credentials provided'};
      return;
    }

    const opts = {
      expiresIn: config.token.expires
    };

    const response = user.toJSON();

    delete response.created_at;
    delete response.updated_at;
    delete response.password;
    delete response.salt;

    const token = jwt.sign(response, config.token.secret, opts);

    ctx.body = {token};
    ctx.status = 201;
  })(ctx, next)
})

export default router;

I am suspicious of the function that I am passing into passport.authenticate as I am not actually returning anything or I am not sure if I should be calling login.

My passport.js file looks like this:


import passport from 'koa-passport';
import User from '../models/User';
import Strategy from 'passport-local';

passport.serializeUser((user, done) => {
  console.log('in serializeUser');
  done(null, user.id);
});

passport.deserializeUser(async (id, done) => {
  try {
    console.log('in deserializeUser');
    const user = await User.findById(id);
    done(null, user);
  } catch(err) {
    done(err);
  }
});

passport.use('local', new Strategy({
  usernameField: 'username',
  passwordField: 'password'
}, async (username, password, done) => {
  try {
    const user = await User.where({
      username
    }).fetch();

    if (!user) {
      return done(null, false)
    }

    try {
      const isMatch = await user.validatePassword(password);

      if (!isMatch) {
        return done(null, false)
      }

      done(null, user)
    } catch (err) {
      done(err)
    }

  } catch (err) {
    return done(err)
  }
}));

Neither serializeUser nor deserializeUser are ever called and I do not understand why.

Is the function that I am passing into passport.authenticate wrong?

with koa-session2

Hi,

I'm trying to use this with koa-session2 since both support v2.x. The ctx.isAuthenticated() is never true

// Require authentication for now
app.use(function (ctx, next) {
  console.dir('url: '+ctx.originalUrl+' auth?: '+ctx.isAuthenticated());     //ctx.isAuthenticated() never true
  if (!ctx.originalUrl.startsWith("/b2b/") || ctx.isAuthenticated()) {
    return next();
  } else {
    ctx.redirect('/');
  }
});

I do see the user and password work. Most of the code I'm testing is based on the https://github.com/mapmeld/koa-passport-example mongo example.

This example runs for me on nodejs 6.2.0. Is there any example or test with koa-session2?

async/await passport-jwt custom handler

Hi,
I am using koa-router and koa-passport with passport-jwt. The problem is that every error thrown inside passport custom callback is not catched by parent middleware. Am I missing something or is this intended behaviour? Can you please provide example how this should work with async/await and koa2?

Best regards

privateRouter.get('/test', isAuthenticated, users.test)

async function authenticate(ctx, next) {
  await passport.authenticate('jwt', { session: false }, async(user, userInfo) => {
       await next() // when next middleware throws error it won't be catched by parent middleware
       throw new Error() // this won't be catched by parent middleware
  })(ctx, next)
}

Is there a way to retrieve Ctx.request?

Hi!

I'm trying to retrieve certain fields that are only available on the koa ctx.request object in the passport.authenticate function of my Strategy. The problem is that the object passed by the middleware is the raw node request object instead of the koa request object

 middleware(ctx.req, res, done) 

https://github.com/rkusa/koa-passport/blob/master/lib/framework/koa.js#L111

Is there a way to work around that?

One way would be to bind everything on the ctx.request object instead of ctx.req. But it would change what users are used to... So like instead of ctx.req.user to retrieve user it would be ctx.request.user and so on.

Branch v2.x : Question passport.initialize()

Hi there,

I 'd like to use "koa-passport" with "koa-jwt-redis-session" to avoid cookies for session handling.

Do you happen to know if the call to "passport.initialze()" is needed in such a scenario?

Please note, I'm using branch "v2.x"

I'm asking this, cause it seems to work even without doing so ..

Thx a lot

getting error with 2.x branch (Koa 2)

error:

  TypeError: fn.apply(...)[(intermediate value)] is not a function
      at Object.<anonymous> (/Users/dave/Documents/repos/eatYourFriends2017/node_modules/koa-route/index.js:34:19)
      at [object Generator].next (native)
      at onFulfilled (/Users/dave/Documents/repos/eatYourFriends2017/node_modules/co/index.js:65:19)
      at /Users/dave/Documents/repos/eatYourFriends2017/node_modules/co/index.js:54:5
      at new Promise (/Users/dave/Documents/repos/eatYourFriends2017/node_modules/core-js/modules/es6.promise.js:193:7)
      at Object.co (/Users/dave/Documents/repos/eatYourFriends2017/node_modules/co/index.js:50:10)
      at converted (/Users/dave/Documents/repos/eatYourFriends2017/node_modules/koa-convert/index.js:17:15)
      at dispatch (/Users/dave/Documents/repos/eatYourFriends2017/node_modules/koa-compose/index.js:43:32)
      at next (/Users/dave/Documents/repos/eatYourFriends2017/node_modules/koa-compose/index.js:44:18)
      at /Users/dave/Documents/repos/eatYourFriends2017/node_modules/koa-passport/lib/framework/koa.js:143:16
      at run (/Users/dave/Documents/repos/eatYourFriends2017/node_modules/core-js/modules/es6.promise.js:89:22)
      at /Users/dave/Documents/repos/eatYourFriends2017/node_modules/core-js/modules/es6.promise.js:102:28
      at flush (/Users/dave/Documents/repos/eatYourFriends2017/node_modules/core-js/modules/_microtask.js:18:9)
      at nextTickCallbackWith0Args (node.js:420:9)
      at process._tickDomainCallback (node.js:390:13)

code


import Koa from 'koa';
const session = require('koa-generic-session');
import convert from 'koa-convert';
import config from '../config';
import twitterLogin from './middleware/twitterLogin';
const app = new Koa();

// ------------------------------------
// Session
// ------------------------------------
app.keys = ['your-session-secret'];
app.use(convert(session(app)));

console.log('------ server config: ', config);

// --------------------------------------
// passport
// --------------------------------------

// body parser
var bodyParser = require('koa-bodyparser');
app.use(bodyParser());

var passport = require('koa-passport');
app.use(passport.initialize());
app.use(passport.session());

twitterLogin(app, config, passport);

export default app;

twitterLogin.js

import util from 'util';
const twitterConfig = require('./../keys/twitter.json');
const TwitterStrategy = require('passport-twitter').Strategy;
const route = require('koa-route');

export default (app, config, passport) => {
    const twitterCallbackUrl = `http://${config.server_host}:${config.api_port}/auth/twitter/callback`;

    console.log('twitter callback url: ', twitterCallbackUrl);
    /**
     * TWITTER login
     */

    var keys = {
        callbackURL: twitterCallbackUrl,
        consumerKey: twitterConfig.consumer_key,
        consumerSecret: twitterConfig.consumer_secret
    };

    passport.use(new TwitterStrategy(keys,
        function (token, tokenSecret, profile, cb) {
            profile.twAuth = {
                tokenSecret,
                token
            };
            console.log('profile: ', util.inspect(profile, {depth: 0}));
            cb(null, profile);
            // UserModel.findOrSaveTwitter(profile)
            //    .then(user => cb(null, user));
        }
    ));

    app.use(route.get('/auth/twitter', passport.authenticate('twitter')));

    app.use(route.get('/auth/twitter/callback',
        passport.authenticate('twitter', {
            successRedirect: '/',
            failureRedirect: '/'
        })
    ));

    /*   app.use(function *(next) {
     yield next;
     if (this.session && this.session.user) {
     console.log('user: ', this.session.user);
     console.log('body: ', this.body);
     }
     }); */
};

package.json

{
  "name": "react-redux-starter-kit",
  "version": "3.0.0-alpha.0",
  "description": "Get started with React, Redux, and React-Router!",
  "main": "index.js",
  "engines": {
    "node": ">=4.2.0",
    "npm": "^3.0.0"
  },
  "scripts": {
    "clean": "rimraf dist",
    "compile": "better-npm-run compile",
    "lint": "eslint src tests server",
    "lint:fix": "npm run lint -- --fix",
    "start": "better-npm-run start",
    "dev": "better-npm-run dev",
    "dev:no-debug": "npm run dev -- --no_debug",
    "test": "better-npm-run test",
    "test:dev": "npm run test -- --watch",
    "deploy": "better-npm-run deploy",
    "deploy:dev": "better-npm-run deploy:dev",
    "deploy:prod": "better-npm-run deploy:prod",
    "codecov": "cat coverage/*/lcov.info | codecov"
  },
  "betterScripts": {
    "compile": {
      "command": "babel-node bin/compile",
      "env": {
        "DEBUG": "app:*"
      }
    },
    "dev": {
      "command": "nodemon --exec babel-node bin/server",
      "env": {
        "NODE_ENV": "development",
        "DEBUG": "app:*"
      }
    },
    "deploy": {
      "command": "npm run clean && npm run compile",
      "env": {
        "DEBUG": "app:*"
      }
    },
    "deploy:dev": {
      "command": "npm run deploy",
      "env": {
        "NODE_ENV": "development",
        "DEBUG": "app:*"
      }
    },
    "deploy:prod": {
      "command": "npm run deploy",
      "env": {
        "NODE_ENV": "production",
        "DEBUG": "app:*"
      }
    },
    "start": {
      "command": "babel-node bin/server",
      "env": {
        "DEBUG": "app:*"
      }
    },
    "test": {
      "command": "babel-node ./node_modules/karma/bin/karma start build/karma.conf",
      "env": {
        "NODE_ENV": "test",
        "DEBUG": "app:*"
      }
    }
  },
  "repository": {
    "type": "git",
    "url": "git+https://github.com/davezuko/react-redux-starter-kit.git"
  },
  "author": "David Zukowski <[email protected]> (http://zuko.me)",
  "license": "MIT",
  "dependencies": {
    "babel-cli": "^6.5.1",
    "babel-core": "^6.3.17",
    "babel-loader": "^6.2.0",
    "babel-plugin-transform-runtime": "^6.3.13",
    "babel-polyfill": "^6.9.0",
    "babel-preset-es2015": "^6.3.13",
    "babel-preset-react": "^6.3.13",
    "babel-preset-react-optimize": "^1.0.1",
    "babel-preset-stage-0": "^6.3.13",
    "babel-register": "^6.3.13",
    "babel-runtime": "^6.3.19",
    "better-npm-run": "0.0.9",
    "css-loader": "^0.23.0",
    "cssnano": "^3.3.2",
    "debug": "^2.2.0",
    "extract-text-webpack-plugin": "^1.0.0",
    "file-loader": "^0.9.0",
    "fs-extra": "^0.30.0",
    "history": "^2.0.0",
    "html-webpack-plugin": "^2.7.1",
    "imports-loader": "^0.6.5",
    "ip": "^1.1.2",
    "json-loader": "^0.5.4",
    "koa": "^2.0.0-alpha.3",
    "koa-bodyparser": "^2.2.0",
    "koa-connect-history-api-fallback": "^0.3.0",
    "koa-convert": "^1.2.0",
    "koa-generic-session": "^1.11.1",
    "koa-passport": "git+ssh://[email protected]/rkusa/koa-passport.git#v2.x",
    "koa-proxy": "^0.6.0",
    "koa-route": "^2.4.2",
    "koa-session": "^3.3.1",
    "koa-static": "^3.0.0",
    "node-sass": "^3.7.0",
    "normalize.css": "^4.1.1",
    "passport-twitter": "^1.0.4",
    "postcss-loader": "^0.9.0",
    "react": "^15.0.0",
    "react-dom": "^15.0.0",
    "react-redux": "^4.0.0",
    "react-router": "^2.2.0",
    "react-router-redux": "^4.0.0",
    "redux": "^3.0.0",
    "redux-thunk": "^2.0.0",
    "rimraf": "^2.5.1",
    "sass-loader": "^3.0.0",
    "style-loader": "^0.13.0",
    "url-loader": "^0.5.6",
    "webpack": "^1.12.14",
    "yargs": "^4.0.0"
  },
  "devDependencies": {
    "babel-eslint": "^6.0.0-beta.6",
    "chai": "^3.4.1",
    "chai-as-promised": "^5.1.0",
    "chai-enzyme": "^0.5.0",
    "cheerio": "^0.20.0",
    "codecov": "^1.0.1",
    "enzyme": "^2.0.0",
    "eslint": "^2.10.2",
    "eslint-config-standard": "^5.1.0",
    "eslint-config-standard-react": "^2.2.0",
    "eslint-plugin-babel": "^3.2.0",
    "eslint-plugin-flow-vars": "^0.4.0",
    "eslint-plugin-promise": "^1.0.8",
    "eslint-plugin-react": "^5.0.0",
    "eslint-plugin-standard": "^1.3.1",
    "isparta-loader": "^2.0.0",
    "karma": "^1.0.0",
    "karma-coverage": "^1.0.0",
    "karma-mocha": "^1.0.1",
    "karma-mocha-reporter": "^2.0.0",
    "karma-phantomjs-launcher": "^1.0.0",
    "karma-webpack-with-fast-source-maps": "^1.9.2",
    "material-ui": "^0.15.1",
    "mocha": "^2.2.5",
    "nodemon": "^1.8.1",
    "phantomjs-prebuilt": "^2.1.3",
    "react-addons-test-utils": "^15.0.0",
    "react-mdl": "^1.6.0",
    "react-tap-event-plugin": "^1.0.0",
    "redbox-react": "^1.2.2",
    "redux-devtools": "^3.3.1",
    "redux-devtools-dock-monitor": "^1.1.1",
    "redux-devtools-log-monitor": "^1.0.11",
    "sinon": "^1.17.3",
    "sinon-chai": "^2.8.0",
    "webpack-dev-middleware": "^1.6.1",
    "webpack-hot-middleware": "^2.6.0"
  }
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.