Skip to content

Commit

Permalink
v1.0.1. Added note about body-parser prerequisite to README
Browse files Browse the repository at this point in the history
  • Loading branch information
JamesMGreene committed Dec 6, 2015
1 parent c8fad9c commit da1dfb8
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
16 changes: 16 additions & 0 deletions README.md
Expand Up @@ -15,6 +15,22 @@ $ npm install passport-json-custom

## Usage

### Prerequisites

Before you can use this strategy, you _MUST_ ensure that your request (`req`) object always has a `body` property that is populated appropriately with parsed JSON.

For example, if you are using Passport and this strategy within Express `4.x` or above, you would want to set up the [`'body-parser'` middleware](https://www.npmjs.com/package/body-parser) to parse the request body's JSON before setting up the Passport middleware:

```js
var express = require('express');
var bodyParser = require('body-parser');

var app = express();

app.use(bodyParser.json());
```


### Configure Strategy

The JSON Custom authentication strategy authenticates users using any custom set of JSON-based credentials. The strategy requires a `verify` callback, which accepts these credentials and calls `done` providing a user.
Expand Down
2 changes: 1 addition & 1 deletion package.json
@@ -1,6 +1,6 @@
{
"name": "passport-json-custom",
"version": "1.0.0",
"version": "1.0.1",
"description": "A Passport.js strategy for custom authentication via JSON from the request body",
"repository": {
"type": "git",
Expand Down

0 comments on commit da1dfb8

Please sign in to comment.