1.0.0 • Published 5 years ago

express-bearer-token-auth v1.0.0

Weekly downloads
2
License
Apache License 2....
Repository
github
Last release
5 years ago

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));