expressjs-authtoken

1.0.2 • Public • Published

expressjs=authtoken is the middleware to read the authentication token from the request

How to use?

var authToken = require("expressjs-authtoken");
app.use(authToken());

if we don't specify any props, it will take from headers and with authorization key

passing custom props

by passing the custom props you can read the key from headers, body and params

Example

app.use(
  authToken({
    key: "authorization", //key to read from the request , default value is authorization
    readFrom: "headers", // read from headers/body/params, default value is headers
    isMandatory: true, // is authorization key mandatory, if mandatory is true then it will throw an error, defaut value is false,
    ignore: 7, // ignore characters from start to remove such as Bearer
  })
);

Package Sidebar

Install

npm i expressjs-authtoken

Weekly Downloads

1

Version

1.0.2

License

ISC

Unpacked Size

2.46 kB

Total Files

3

Last publish

Collaborators

  • ravivarma1192