Skip to content

Commit

Permalink
Merge 3282b88 into 3b9980f
Browse files Browse the repository at this point in the history
  • Loading branch information
zrisher committed Jan 18, 2017
2 parents 3b9980f + 3282b88 commit 1c4a308
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion README.md
Expand Up @@ -31,6 +31,9 @@ password. The strategy requires a `verify` callback, which accepts these
credentials and calls `done` providing a user.

```js
passport = require('passport');
LocalStrategy = require('passport-local').Strategy;

passport.use(new LocalStrategy(
function(username, password, done) {
User.findOne({ username: username }, function (err, user) {
Expand Down Expand Up @@ -92,12 +95,17 @@ accordingly.
#### Authenticate Requests

Use `passport.authenticate()`, specifying the `'local'` strategy, to
authenticate requests.
authenticate requests. It searches for fields in the query string and
`req.body`, so ensure body parsers are in place if these fields are
sent in the body.

For example, as route middleware in an [Express](http://expressjs.com/)
application:

```js
app.use(require('body-parser').urlencoded({ extended: true }));
app.use(passport.initialize());

app.post('/login',
passport.authenticate('local', { failureRedirect: '/login' }),
function(req, res) {
Expand Down

0 comments on commit 1c4a308

Please sign in to comment.