express-bearer-token-auth

1.0.0 • Public • Published

Description

Express middleware for bearer token authentication with jwt.
Env variable "TOKEN_KEY" is required, otherwise throws Error.
verifyOptions parameter is not required. Refer to jsonwebtoken package site for available options.
Populates req.claims with payload part of jwt if verified.
If bearer token can not be verified, responds the request with the status 401.

Usage

const express = require("express");
const app = express();
const auth = require('express-bearer-token-auth');
const verifyOptions = { algorithm: 'RS256' };
app.use(auth(verifyOptions));

Package Sidebar

Install

npm i express-bearer-token-auth

Weekly Downloads

0

Version

1.0.0

License

Apache License 2.0

Unpacked Size

13.8 kB

Total Files

4

Last publish

Collaborators

  • safa96