jaredhanson / passport-http

HTTP Basic and Digest authentication strategies for Passport and Node.js.

Home Page:https://www.passportjs.org/packages/passport-http/?utm_source=github&utm_medium=referral&utm_campaign=passport-http&utm_content=about

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

BasicStrategy not found

elspru opened this issue · comments

There is insufficient documentation to get a working example.

Using the snippet from the README leads to the following error:

/srv/www/routes/v1.js:8
passport.use(new BasicStrategy(
^

ReferenceError: BasicStrategy is not defined
at Object. (/srv/www/routes/v1.js:8:18)
at Module._compile (internal/modules/cjs/loader.js:688:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:699:10)
at Module.load (internal/modules/cjs/loader.js:598:32)
at tryModuleLoad (internal/modules/cjs/loader.js:537:12)
at Function.Module._load (internal/modules/cjs/loader.js:529:3)
at Module.require (internal/modules/cjs/loader.js:636:17)
at require (internal/modules/cjs/helpers.js:20:18)
at Object. (/srv/www/server.js:11:12)
at Module._compile (internal/modules/cjs/loader.js:688:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:699:10)
at Module.load (internal/modules/cjs/loader.js:598:32)
at tryModuleLoad (internal/modules/cjs/loader.js:537:12)
at Function.Module._load (internal/modules/cjs/loader.js:529:3)
at Function.Module.runMain (internal/modules/cjs/loader.js:741:12)
at startup (internal/bootstrap/node.js:285:19)

Please add the following line to the README:

const BasicStrategy = require('passport-http').BasicStrategy;

It shouldn't require reading the source code to figure out how to use your library when you have a README. include the require lines and save people countless hours of Error messages and ill feelings.
.

commented

This was helpful, thanks @elspru.

For the record, I tried const BasicStrategy = require('passport-http/strategies/basic'); to no avail. Just presented with a "module not found error".