Skip to content
This repository has been archived by the owner on Sep 28, 2021. It is now read-only.

fix bug: use passport provided in options hash #55

Closed
wants to merge 3 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 4 additions & 1 deletion lib/index.js
Expand Up @@ -17,7 +17,6 @@ function parseCookie(auth, cookieHeader) {

function authorize(options) {
var defaults = {
passport: require('passport'),
key: 'connect.sid',
secret: null,
store: null,
Expand All @@ -27,6 +26,10 @@ function authorize(options) {

var auth = xtend(defaults, options);

if (!auth.passport){
auth.passport = require('passport'); //not added in defaults, because that would already load the other passport.
}

auth.userProperty = auth.passport._userProperty || 'user';

if (!auth.cookieParser) {
Expand Down